Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add an attribute to an Elasticsearch node for the purpose of Shard Allocation Filtering?

I'm attempting to follow the reference guide to make sure certain indexes end up on certain machines. I'm attempting to give 2 of my nodes an attribute named "storage_type", where one node gets "long_term" and one gets "short_term".

I understand that I need to add the attribute of "storage_type" to each of the nodes, and then set each index to have {"index.routing.allocation.require.tag" : "short"} or {"index.routing.allocation.require.tag" : "long"} respectively.

I've attempted to add these settings via curl calls, like most ES things, but it does not appear that I could PUT settings. i.e.:

 curl -XPUT localhost:9200/_nodes/my_node_name/_settings -d '{"storage_term" : "short_term"}'

So how do I add these attributes such as "storage_type" (which is n to nodes)? Is it a config file? A command line argument? An HTTP call that I'm missing?

like image 404
Phil Barresi Avatar asked Oct 29 '25 14:10

Phil Barresi


2 Answers

Since version 5.0 node attributes are to be set via node.attr.:

node.attr.storage_term: short_term

See Shard Allocation Filtering section of the official reference.

like image 183
Serge S. Avatar answered Oct 31 '25 11:10

Serge S.


It's not to be done through curl calls. You need to use elasticsearch.yml.

  • in elasticsearch.yml:
node.storage_term: short_term
like image 31
Andrei Stefan Avatar answered Oct 31 '25 10:10

Andrei Stefan