What is the best value to use for preference parameter when quering elastic search directly from custom dashboard?

hi,

We query elastic search using node but the thing is we do have preference parameter in our queries as we don't have an idea which value will be the best to use for preference as shards are managed by the elasticsearch so what can be a general value we can use with every query to elasticsearch for prefrence that result in good performance. Right now we are using undefined for prefrence.

I am looking into the documentation the possible value for prefrence

  1. _local
  2. _only_local

but here they say The operation will be executed on shards allocated to the local node what is mean by local node here ?

The correct value to use depends on the reason you are using preference in the first place. What are you looking to achieve by using it?

Local node I believe is the one that receives and coordinates the request.

we were looking how kibana is making request to the elasticsearch ..... it was using prefrence parameter in it even though it's value keeps on changing so we were just wondering may be it can affect performance somehow.

Kibana uses preference to improve consistency across the many requests it fires off in parallel. This means that all requests grouped together will be served by the same set of shards.

If you do not have a similar reason to use preference, do not use it. It is after all an optional feature.

ok thanks @Christian_Dahlqvist got it

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.