<commit_before>[[shard-allocation-filtering]]
=== Shard Allocation Filtering

Shard allocation filtering allows you to specify which nodes are allowed
to host the shards of a particular index.

NOTE: The per-index shard allocation filters explained below work in
conjunction with the cluster-wide allocation filters explained in
<<shards-allocation>>.

It is possible to assign arbitrary metadata attributes to each node at
startup.  For instance, nodes could be assigned a `rack` and a `group`
attribute as follows:

[source,sh]
------------------------
bin/elasticsearch -Enode.attr.rack=rack1 -Enode.attr.size=big  <1>
------------------------
<1> These attribute settings can also be specified in the `elasticsearch.yml` config file.

These metadata attributes can be used with the
`index.routing.allocation.*` settings to allocate an index to a particular
group of nodes.  For instance, we can move the index `test` to either `big` or
`medium` nodes as follows:


[source,js]
------------------------
PUT test/_settings
{
  "index.routing.allocation.include.size": "big,medium"
}
------------------------<commit_msg>Fix a trivial typo in Reference document<commit_after>[[shard-allocation-filtering]]
=== Shard Allocation Filtering

Shard allocation filtering allows you to specify which nodes are allowed
to host the shards of a particular index.

NOTE: The per-index shard allocation filters explained below work in
conjunction with the cluster-wide allocation filters explained in
<<shards-allocation>>.

It is possible to assign arbitrary metadata attributes to each node at
startup.  For instance, nodes could be assigned a `rack` and a `size`
attribute as follows:

[source,sh]
------------------------
bin/elasticsearch -Enode.attr.rack=rack1 -Enode.attr.size=big  <1>
------------------------
<1> These attribute settings can also be specified in the `elasticsearch.yml` config file.

These metadata attributes can be used with the
`index.routing.allocation.*` settings to allocate an index to a particular
group of nodes.  For instance, we can move the index `test` to either `big` or
`medium` nodes as follows:


[source,js]
------------------------
PUT test/_settings
{
  "index.routing.allocation.include.size": "big,medium"
}
------------------------
{'fraction_non_alphanumeric': 0.15520282186948853, 'fraction_numerical': 0.0026455026455026454, 'mean_word_length': 3.1786372007366483, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '371249', 'n_tokens_mistral': 594, 'n_tokens_neox': 585, 'n_words': 262}