You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parent/child inner hits seem to support requesting only the '_source' field. Inner hits on nested objects on the contrary support asking for any field.
The documentation is not extremely clear on the subject, but I think it should work.
I have this behavior on ElasticSearch 1.7.2.
This script reproduces the problem in the more concise way i could think of:
printf"Delete index:\n\n"
curl -XDELETE localhost:9200/test
printf"\n\nPrepare mappings with parent/child relationship and some nested object:\n\n"
curl -XPUT localhost:9200/test -d '{ "mappings": { "company": { "properties": { "addresses": { "type": "nested" } } }, "employee": { "_parent": { "type": "company" } } }}'printf"\n\nInsert a company with nested address:\n\n"
curl -XPUT localhost:9200/test/company/mgdis -d '{ "companyName": "MGDIS", "addresses": [{ "city": "Vannes", "country": "France" }]}'printf"\n\nInsert a employee child of the company:\n\n"
curl -XPUT localhost:9200/test/employee/alban?parent=mgdis -d '{ "name": "Alban Mouton"}'printf"\n\nFlush index:\n\n"
curl -XPOST 'http://localhost:9200/test/_flush'printf"\n\nSearch a company with nested addresses in inner hits. The field 'city' IS PRESENT:\n\n"
curl -XPOST localhost:9200/test/company/_search -d '{ "query": { "nested": { "path": "addresses", "query": { "match_all": {} }, "inner_hits": { "fields": ["city"] } } }}'printf"\n\nSearch an employee with parent company in inner hits. The field 'companyName' SHOULD BE PRESENT:\n\n"
curl -XPOST localhost:9200/test/employee/_search -d '{ "query": { "has_parent": { "parent_type": "company", "query": { "match_all": {} }, "inner_hits": { "fields": ["companyName"] } } }}'printf"\n\nSearch a company with child employee in inner hits. The field 'name' SHOULD BE PRESENT:\n\n"
curl -XPOST localhost:9200/test/company/_search -d '{ "query": { "has_child": { "type": "employee", "query": { "match_all": {} }, "inner_hits": { "fields": ["name"] } } }}'
The text was updated successfully, but these errors were encountered:
Hi @albanm if you remove the company/employee type from the url then I expect the last two queries to work.
There is an issue with the inner query wrapped has_child/has_parent can't access mapping information from the child or parent type if a type is specified in the url. This has been fixed in 2.0.
Hello,
The parent/child inner hits seem to support requesting only the '_source' field. Inner hits on nested objects on the contrary support asking for any field.
The documentation is not extremely clear on the subject, but I think it should work.
I have this behavior on ElasticSearch 1.7.2.
This script reproduces the problem in the more concise way i could think of:
The text was updated successfully, but these errors were encountered: