Non flatten field path for results


(Han JU) #1

Hi,

I found that sometimes the field path in query results are flatten, like:

{'a.b': 'my_result'}

In fact this happens if 'b' is the only required field under 'a'.

However I need to do some post processing on query results and I hope they
can be in a consistent format.
So I'd like to know is there's a way to force the query result in a nested
way? Like:

{'a': {'b': 'my_result'}}

Thanks!

--
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/b571e471-47e8-4fa7-a523-6344dd22f32a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #2

You can use source filtering for this:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-source-filtering.html

Example:

_search
{
"_source": [ "a.b" ]
}

--
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/002ff553-11aa-4543-b803-c9f9264bb416%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3