Search for available fields

Hi,

What is the most efficient way to get all available fields to search on for
a preliminary search criteria?

Thanks,

Shooali

--
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/db45232a-a454-4ee8-b2b6-4a8f0a7f3d41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The following query will return all of the mappings for all of the indices
on the specified ES host:

$ curl -XGET 'http://hostname:9200/_all/_mapping?pretty=true' && echo

You can read the JSON, or else parse it and extract the details you need.
For example, if you have automatic mapping enabled, this is a very good way
to not only discover the searchable fields but also see if they are strings
or numbers.

Brian

On Tuesday, September 30, 2014 11:15:32 AM UTC-4, shooali wrote:

Hi,

What is the most efficient way to get all available fields to search on
for a preliminary search criteria?

Thanks,

Shooali

--
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/95cd8e08-bba6-451c-96c5-8e3c6a1e1fff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.

Thanks,

On Tuesday, September 30, 2014 6:24:26 PM UTC+3, Brian wrote:

The following query will return all of the mappings for all of the indices
on the specified ES host:

$ curl -XGET 'http://hostname:9200/_all/_mapping?pretty=true' && echo

You can read the JSON, or else parse it and extract the details you need.
For example, if you have automatic mapping enabled, this is a very good way
to not only discover the searchable fields but also see if they are strings
or numbers.

Brian

On Tuesday, September 30, 2014 11:15:32 AM UTC-4, shooali wrote:

Hi,

What is the most efficient way to get all available fields to search on
for a preliminary search criteria?

Thanks,

Shooali

--
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/83dedc03-4193-41ea-9fa6-1d0ac2a0df98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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+unsubscribe@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.