The Life of a Radar

Filtering by index in Elasticsearch
03 Dec 2014

Today I needed to filter by indexes in an Elasticsearch instance, and so I googled for how to do this but I couldn't find anything other than the indicies filter which isn't helpful without a proper context of where to use it in a query.

Instead of that filter, this is what I came up with to do the filtering:

client = Elasticsearch.new
client.search(index: "logstash-2014.12.03,logstash-2014.12.02...", body: {
  query: {
    ...
  }
})

I hope this post can help other people who are looking for the same thing.

25 back

The Complete Blogography