In that case, your strategy seems fine. ES has already done all the real 
work of creating the responses, and I would expect that iterating across 
them and gathering the fields into a Set should be rather quick.

However, you still might wish to get the mappings for the index. Why? 
Because once you've collected the subset of fields within your current 
response, you still can only search on the ones that are indexed. So for a 
general solution, you would perhaps want to skip over fields that are 
stored in the documents but not indexed.

Brian

On Tuesday, September 30, 2014 6:01:20 PM UTC-4, shooali wrote:
>
> Thank you Brian,
>
> However, I am looking for something slightly different. I don't want to 
> know all the fields for an index, I want to know for a certain subset of 
> the documents I have indexed, what are the relevant fields that I can 
> continue search on. For example:
> If I have 5 fields total for my index, Then I search for all document that 
> satisfy certain criteria, for example, all documents that FieldA equals 
> '5'. Only for those, what are the available fields that I can continue on 
> search on... 
> The way I thought I can do this is to go over all result of the first 
> search and collect all fields of these documents into a Set and use those. 
> My question is whether there is a better/more performant way to achieve 
> this goal.
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/4ae1168c-2526-4ba6-937a-1f2b1bc90a0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to