elasticsearch - I can't get nested stored_fields -
all. i'm using elasticsearch 5.0 , have next mapping:
{ "mappings": { "object":{ "properties":{ "attributes":{ "type":"nested", "properties":{ "name": { "type": "keyword", "store":true}, "value": { "type": "text", "store":true }, "converted": {"type": "double", "store":true}, "datetimestamp": { "type": "date", "store":true} } } } } } }
then add 1 document:
{ "attributes":[ {"name":"attribute_string", "value":"string_value","converted":null,"datetimestamp":null}, {"name":"attribute_double", "value":"1234.567","converted":1234.567,"datetimestamp":null}, {"name":"attribute_datetime", "value":"2015-01-01t12:10:30z","converted":null,"datetimestamp":"2015-01-01t12:10:30z"} ] }
when query w/ "stored_fields", don't have fields in results:
_search { "stored_fields":["attributes.converted"] }
results:
{ "_index": "test_index", "_type": "object", "_id": "1", "_score": 1 }
but when use "_source":["attributes.converted"] , have result:
{ "_index": "test_index", "_type": "object", "_id": "1", "_score": 1, "_source": { "attributes": [ { "converted": null }, { "converted": 1234.567 }, { "converted": null } ] } }
what proper way use stored_fields? usage of "_source" affect performance compare "stored_fields" approach?
if "_source" approach fast "stored_fields", shall remove "store":true fields?
thank you.
you're using nested types
, use inner_hits
.
in nested case, documents returned based on matches in nested inner objects.
documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html
Comments
Post a Comment