-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Parent/Child and Nested field support for query_string queries #16551
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
Comments
+1 . I'm wondering about the complexity here. AFAIK the query string query is a Lucene feature exposed by ES, and parent/child is ES only. I'm not sure what the technical implications of doing this would be, since I think it would require moving the query string syntax code into the ES core, which IIRC is in Lucene core ATM. |
+1 definitely helpful |
+1 |
1 similar comment
+1 |
I've updated the title to include access to nested fields (originally requested in #11322). What I'd be interested in seeing is what the query string syntax would look like for accessing parent/child/nested docs. |
@clintongormley I think the syntax would be exactly as it is for Inner Objects which use simple dot-notation to reference deeper elements of the indexed JSON source. The root field should be the name of the parent type, so let's say you have Company and Employee types, where Company is parent to the Employee, I should be able to query:
In this contrived example, location is a field of the parent Company type, and employees.women is a inner object of the Company type. Name is a field of the Employee type. query_string queries already support inner field/nested object query specifiers via dot-notation. I have reviewed #11322 and Nested Documents are a significantly different use case than 'inner fields' which is the reference I intended to make in my intro. The largest difference is that the parent will always be a has_one type relationship to the child - which means that there isn't some type of document reduction necessary to calculate score, etc - as appears may be the case in the nested document scenario. So, to keep the complexity and effort for this case low, I'd suggest not to co-mingle it with the potentially more challenging Nested Documents scenario. |
+1 |
+1 |
Chiming in here to reiterate my comment from #11322 (comment)
|
+1 |
16 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
@elastic/es-search-aggs |
We discussed internally and agreed that it's something that we'd like to have.
|
Yeah nested support is something we've wanted to add to kuery, but we just haven't had time for yet. |
+1 |
+1 |
So if we use nested objects we can sort on sub-objects but not search them with a query_string. So the options are:
|
I have a schema with a lot of object arrays. Being able to index them as nested objects and then have support for nested queries in the query_string query would really make my day. Or support them in KQL and allow ES queries with KQL. |
This issue hasn't been touched in a while and i suspect that there hasn't been enough interest in this feature to make it a priority. However, I do think that having support for nested fields via lucene syntax is a big deal. I would love to see this feature, we will need to support sorting on sub-objects. Right now the only way to accomplish this is to use Nested types. I guess, as an alternative for my use case.. is there a way support sorting on sub-object fields? If so then our use case would be solved. |
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
I am requesting that query_string queries be able to specify parent fields as part of the query_string query. This should not cause any scaling challenges as parent-child mapping ensures that both documents will be located on the same shard, the syntax is well supported for nested data, and this is an intuitive use case for parent mappings.
Currently there are two terrible ways to return Children based on search criteria for Parents:
If there is some technical reason this cannot be accomplished, please advise. If this is a feature others could use, please leave a +1 to get this issue some attention.
Thanks,
D
The text was updated successfully, but these errors were encountered: