Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent handling of node IDs in preference and _cat/nodes #27843

Closed
mtritschler opened this issue Dec 15, 2017 · 3 comments
Closed

Inconsistent handling of node IDs in preference and _cat/nodes #27843

mtritschler opened this issue Dec 15, 2017 · 3 comments

Comments

@mtritschler
Copy link

Elasticsearch version (bin/elasticsearch --version): 5.4.0

Plugins installed: [x-pack]

JVM version (java -version):
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

OS version (uname -a if on a Unix-like system):
Linux searchlog001 4.4.0-96-generic #119-Ubuntu SMP

Description of the problem including expected versus actual behavior:
GET /_cat/nodes?h=id returns just the first four characters of the node id, so it seems as if this would suffice to identify a node. However, when using just the first four characters as value for preference=_prefer_nodes:..., the preference does not get honored and search results from replicas on other nodes may get returned. The preference does only apply when one uses the full-length ID of a node.

Steps to reproduce:

  1. Setup a cluster with at least two nodes. Create an index with a single shard and one replica
  2. Index a single document
  3. Do curl $ELASTIC_HOST:9200/_cat/nodes?h=name,id to obtain a short node ID and the host name
  4. Query for the document with "explain": true to see the node in the response and set preference=_prefer_nodes:$NODE_ID, repeat to see eventually varying node IDs in the response
  5. Do curl $ELASTIC_HOST:9200/_nodes to get the full-length node IDs (keys in /nodes)
  6. Query for the document as above but with the preference using the full, repeat to always see the specified node ID in the response
@jasontedor
Copy link
Member

The short ID is for display purposes. There is a documented parameter for the cat nodes API (like full_id) that shows the full ID needed for preferences. I’m closing this as expected behavior and not a bug.

@mtritschler
Copy link
Author

mtritschler commented Dec 15, 2017 via email

@jasontedor
Copy link
Member

Yes, it was undocumented previously although works but it is documented starting in 5.6. I hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants