Skip to content

Incorrect Documentation: nested_path #27098

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

Closed
lukas-gitl opened this issue Oct 24, 2017 · 3 comments · Fixed by #42809
Closed

Incorrect Documentation: nested_path #27098

lukas-gitl opened this issue Oct 24, 2017 · 3 comments · Fixed by #42809
Labels
>docs General docs changes :Search/Search Search-related issues that do not fall into other categories

Comments

@lukas-gitl
Copy link

lukas-gitl commented Oct 24, 2017

It is not clear when one should use nested_path. We've had some issues with this. More details in next post.

@lukas-gitl lukas-gitl changed the title Broken Boolean Sort Incorrect Documentation: nested_path Oct 24, 2017
@MacMcIrish
Copy link
Contributor

The issue was actually not related to boolean search, but to nested search. Here is a short outline of the problem and our solution.

We would like to request the documentation (https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-sorting.html) to be updated to better reflect how and when someone should use the nested_path

It's mentioned that the field is mandatory in https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html , but very few examples show it's use.

Our test data: data.txt

Our test schema: schema.txt

Our test query: query1.txt

Resulted in : result1.txt

Note the negative integer under sort.

Changing the query to : query2.txt
(Note the newly added "nested_path" field)
Resulted in : result2.txt

@cbuescher cbuescher added :Nested Docs >docs General docs changes labels Oct 25, 2017
@cbuescher cbuescher added the help wanted adoptme label Nov 7, 2017
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Nested Docs labels Feb 14, 2018
@talevy talevy added :Search/Search Search-related issues that do not fall into other categories and removed :Search/Search Search-related issues that do not fall into other categories labels Mar 26, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

jimczi added a commit to jimczi/elasticsearch that referenced this issue Jun 3, 2019
This commit removes the nested_path and nested_filter options deprecated in 6x.
This change also checks that the sort field has a [nested] option if it is under a nested
object and throws an exception if it's not the case.

Closes elastic#27098
@jimczi
Copy link
Contributor

jimczi commented Jun 3, 2019

Thanks @MacMcIrish and @lukas-gitl and sorry for the (very) late reply. The negative value in the first example is the default value that we use when the field is missing in the document. It's happening because the field is nested but the nested context is missing so we search the value inside the root document. The nested value is correctly extracted in the second example where the nested context is correctly set. I opened #42809 to throw an exception if a nested field is used in a sort specification without the nested context and added a note in the documentation regarding this behavior.

@jimczi jimczi removed the help wanted adoptme label Jun 3, 2019
jimczi added a commit that referenced this issue Jun 27, 2019
This commit removes the nested_path and nested_filter options deprecated in 6x.
This change also checks that the sort field has a [nested] option if it is under a nested
object and throws an exception if it's not the case.

Closes #27098
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants