Analyze Request - Local parameter

The Analyze endpoint does not seem to have a "local" parameter to specify the preference.
Is it just missing or is that on purpose and I am missing something?

I noticed it was possible in the 0.* and 1.* versions of ES and was then removed after that.

The analyze endpoint does not access any data on a shard, so there is no need for such parameter. It only needs to access the mapping configuration if you specify an index in a request in order to be able to read the analyzer that may be configured in a request.

Maybe you can explain why you think it is needed to make sure we get rid of any confusion.

I was setting parameters for requests and I was expecting to have a parameter local as preference.
I noticed it was removed in 2.0 so I looked at the code and if I understand correctly

An AnalyzeRequest is sent to a node.
If an index was specified, then it is sent to a random node (that must have a shard of the index)
  See TransportAnalyzeAction:shards
  See TransportSingleShardAction.AsyncSingleAction:perform
Else it is sent to the local node 

Why not have the possibility to send it to the local node as a preference
I ask this because when I typed it, I ended up on a "preferLocal" option that was present in ES 1.7

For the equivalent code (TransportSingleCustomOperationAction.AsyncSingleAction:performFirst)

  If no index specified, it executes on the local node as newer versions
    if preferLocalShard, then it executes it on the local node (with a shard of the index)
    Else or if local node is a not appropriate, it is similar to newer versions

The comment of the method even specifies: "First get should try and use a shard that exists on a local node for better performance"
So I was wondering why it was removed in ES 2.0

it looks as it has been removed by a refactoring 7 years ago, see

I don't think you will gain too much by adding this parameter back, as this API is not supposed to be called very often except for debugging issues.

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