How do we determine what routing values are in what elasticsearch shard?


(Gerald DeConto) #1

I am setting up a test index in elasticsearch that will need to deal with a large search load. That said, I started looking into routing to enhance performance.

We decided on one of the document fields as the routing value, and I was able to set up routing easily.

It seems to be working (ie same routing values end up on same shard) when we run this type of query:
GET myindex/mytype/_search?routing=XX&explain

However, we have a number of routing values and I would like to specifically know which routing values are stored on which shard. This is so that we can confirm that routing is balanced across the cluster and so that we don't end up with "hot" shards

So, is there a way to perform a facet/aggregate query on the "_shard" field to get that info? Or some other way to query the documents to see which routing values are on a given shard?

Any help is appreciated


(Mark Walkom) #2

Check out https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html


(Gerald DeConto) #3

Thanks for the quick response Mark. The existing query I am using, "GET myindex/mytype/_search?routing=XX&explain", query does that as well.

I am looking for some summary functionality that would give me a list of what routing values are in what shard, and how many times each routing value occurs in the shard. Basically something similar to a facet of "_shard" values

I could execute the above query manually, but I may have many different routing values and at the development stage, I may not know all the routing values that come in.


(system) #4