Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert date_nanos example script to runtime field #71351

Merged
merged 4 commits into from
Apr 12, 2021

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 6, 2021

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a date_nanos field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291

@nik9000 nik9000 added >docs General docs changes :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.13.0 v7.12.1 labels Apr 6, 2021
@elasticmachine elasticmachine added Team:Docs Meta label for docs team Team:Search Meta label for search team labels Apr 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

"sort": { "date": "asc"} <5>
}
{ "index" : { "_id" : "3" } }
{ "date": 1420070400000 } <4>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was lacking a few 0s in the example and we never caught it because we didn't have a test for the response.

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to elastic#69291
@nik9000
Copy link
Member Author

nik9000 commented Apr 6, 2021

run elasticsearch-ci/docs

@nik9000 nik9000 requested a review from lockewritesdocs April 12, 2021 17:19
Copy link
Contributor

@lockewritesdocs lockewritesdocs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Added some suggested, non-blocking changes.

docs/reference/mapping/types/date_nanos.asciidoc Outdated Show resolved Hide resolved
docs/reference/mapping/types/date_nanos.asciidoc Outdated Show resolved Hide resolved
--------------------------------------------------

----
// TEST[s/_search/_search?filter_path=hits.hits/]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 for filter_path!

@nik9000 nik9000 merged commit e4451bd into elastic:master Apr 12, 2021
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Apr 12, 2021
…ic#71351)

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to elastic#69291

Co-authored-by: Adam Locke <[email protected]>
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Apr 12, 2021
…ic#71351)

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to elastic#69291

Co-authored-by: Adam Locke <[email protected]>
nik9000 added a commit that referenced this pull request Apr 12, 2021
… (#71594)

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291

Co-authored-by: Adam Locke <[email protected]>
nik9000 added a commit that referenced this pull request Apr 12, 2021
… (#71595)

Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291

Co-authored-by: Adam Locke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Docs Meta label for docs team Team:Search Meta label for search team v7.12.1 v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants