How can I query elasticsearch for only one type of record?

rjurney picture rjurney · Mar 28, 2012 · Viewed 19k times · Source

I am issuing a query to elasticsearch and I am getting multiple record types. How do I limit the results to one type?

Answer

imotov picture imotov · Mar 29, 2012

The following query will limit results to records with the type "your_type":

curl - XGET 'http://localhost:9200/_all/your_type/_search?q=your_query'

See http://www.elasticsearch.org/guide/reference/api/search/indices-types.html for more details.