Hello,
1.x Elasticsearch now supports source filtering with "_source"
parameter. Basically this will replace the behaviour of "fields" parameter
in pre-1.x version (especially when fields data are not stored). Migrating
to "_source" is straightforward, however, I noticed one difference when
returning a nested field:
- with "fields" in all versions of ES, a query
{
"query": {
"match_all": {}
},
"fields": "person.name"
}
will return hits as:
{...
"fields": {
"person.name": "Tom"
}
}
- with "_source" in 1.x ES, a query
{
"query": {
"match_all": {}
},
"_source": "person.name"
}
will return hits as:
{...
"_source": {
"person": {
"name": "Tom"
}
}
}
I actually prefer the 2nd format, however, because we are migrating a web
API to our end users, who might still expect the 1st format, I'd like to
maintain the compatibility by giving users option to return nested fields
using dot notation. I can probably do that transformation after ES queries,
but I'm wondering if there is still a way to toggle the return format in ES
directly.
Thanks,
Chunlei
(BTW, I really enjoyed the first ElasticON, you guys did a wonderful job!)
Ref:
http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1060e36d-f60b-45d0-99d0-539ffe089269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.