Skip to content

index setting routing_partition_size is ignored in ES version 7 #48863

Open
@jgaedicke

Description

@jgaedicke

Elasticsearch version (bin/elasticsearch --version): 7.0.0 - 7.4.2

Plugins installed: []

JVM version (java -version): AdoptOpenJDK/OpenJDK 64-Bit Server VM/13.0.1/13.0.1+9 (packed with your docker image)

OS version (uname -a if on a Unix-like system): your dockerimage running on
Mac-OS
Darwin XXXX 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Description of the problem including expected versus actual behavior:
with version 6 of elasticsearch we have used the index setting routing_partition_size to smoothen the issue of hot shards for our custom routing of documents. now we try to upgrade to version 7 of elasticsearch but the feature seems to be broken. it is still described in the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html#routing-index-partition) and we still are able to configure it as an index setting, but
the _search_shards-api and also analyzing the placement of documents with a routing-parameter are showing, that everything is put to only one shard instead of spreading it to what ever is configured in the setting routing_partition_size

Steps to reproduce:

# start elasticsearch e.g. with docker
docker run -it --rm -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.4.2

# delete the index if needed
# curl -XDELETE localhost:9200/test

# create an index with a routing_partition_size set to two
curl -XPUT localhost:9200/test -H "Content-Type: application/json" -d '{
  "settings" : {
    "index" : {
      "number_of_shards" : "20",
      "number_of_replicas": "0",
      "routing_partition_size": "2"
    }
  },
  "mappings": {
    "_routing": {
      "required": true
    }
  }
}
'

# search shards for a routing should return two shards with different shards ids, but is returning only one
curl -XGET "localhost:9200/test/_search_shards?routing=foo&pretty"


# also creating 100 documents with different ids but the same routing should spread the documents over two shards
for i in {1..100}; do curl -XPUT "localhost:9200/test/_doc/$i?routing=foo" -H "Content-Type: application/json" -d "{ \"description\":\"bar $i \"}"; done

# but all 100 documents endup in the same shard ( see number of matches for this single shard)
curl -XGET "localhost:9200/test/_search?preference=_shards:10&pretty&size=0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Distributed Indexing/CRUDA catch all label for issues around indexing, updating and getting a doc by id. Not search.>bugTeam:Distributed (Obsolete)Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions