# Index-setting is not work

**URL:** <https://discuss.elastic.co/t/index-setting-is-not-work/213660>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [January 3, 2020, 6:34am UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660 "2020-01-03T06:34:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leopold-EI](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leopold-ei/32/60220_2.png) [@Leopold-EI](https://discuss.elastic.co/u/Leopold-EI)\
**Post date:** [January 3, 2020, 6:34am UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660/1 "2020-01-03T06:34:21Z")

</div>

Hi,  
I'm useing the rally to test my es-cluster.  
I need to set number\_of\_replicas is 0, but the index still be created with number\_of\_replicas=1. I  
don't understand why, the indices config should be OK.  
the indices body file:  
{  
"settings": {  
"index.number\_of\_shards": {{number\_of\_shards | default(5)}},  
"index.number\_of\_replicas": {{number\_of\_replicas | default(0)}},  
"index.requests.cache.enable": false  
},  
"analysis": {  
"analyzer": {  
"lower\_case\_keyword\_analyzer": {  
"type": "custom",  
"tokenizer": "keyword",  
"filter": "lowercase"  
},  
"2ngram\_analyzer": {  
"tokenizer": "2ngram\_tokenizer"  
}  
},  
"tokenizer": {  
"2ngram\_tokenizer": {  
"type": "ngram",  
"min\_gram": 2,  
"max\_gram": 5,  
"token\_chars": [  
"letter",  
"digit"  
]  
}  
}  
},  
"mappings": {  
"articles": {  
"\_source": {  
"enabled": {{ source\_enabled | default(true) | tojson }}  
},  
"dynamic": "strict",  
"\_all": {  
"enabled": false  
},  
"properties": {  
"docid": {  
"type": "keyword"  
},  
"parentpath": {  
"type": "keyword"  
},  
"basename": {  
"type": "text",  
"analyzer": "hanlp\_index"  
},  
"ext": {  
"type": "text",  
"analyzer": "lower\_case\_keyword\_analyzer",  
"fielddata": true  
},  
"creator": {  
"type": "keyword"  
},  
"created": {  
"type": "long"  
},  
"editor": {  
"type": "keyword"  
},  
"modified": {  
"type": "long"  
},  
"size": {  
"type": "integer"  
},  
"csflevel": {  
"type": "integer"  
},  
"tags": {  
"type": "keyword",  
"fields": {  
"suggest": {  
"type": "completion",  
"analyzer": "lower\_case\_keyword\_analyzer"  
}  
}  
},  
"objtype": {  
"type": "integer"  
},  
"content": {  
"type": "text",  
"analyzer": "hanlp\_index"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)\
**Post date:** [January 3, 2020, 2:48pm UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660/2 "2020-01-03T14:48:05Z")

</div>

Hello,

Could you please reformat the track details in your post using the `</>` icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted? As it is now it's really difficult to read.

Could you also please share your rally command? At the very least you'll need to use [--track-params](https://esrally.readthedocs.io/en/stable/command_line_reference.html#track-params) to specify something like `--track-params=number_of_replicas:0`. As an example you could also take a look at: [https://github.com/elastic/rally-tracks/tree/master/geopoint#parameters](https://github.com/elastic/rally-tracks/tree/master/geopoint#parameters)

Dimitris

---

<div class="post-metadata">

**Author:** ![Leopold-EI](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leopold-ei/32/60220_2.png) [@Leopold-EI](https://discuss.elastic.co/u/Leopold-EI)\
**Post date:** [January 6, 2020, 5:36am UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660/3 "2020-01-06T05:36:17Z")

</div>

Hi, Thanks for your suggest.  
I find the reason，the indices body setting only effective when using create-index。If I set operation-type：bulk，the setting is not working. So I rebuild my challenge like this:

```auto
{
  "name": "index-test-challenge",
  "default": true,
  "description": "新增索引测试",
  "schedule": [
    {
      "operation": {
        "operation-type": "create-index",
        "index": "test-index",
        "settings": {{index_settings | default({}) | tojson}}
      }
    },
    {
      "operation": {
        "operation-type": "bulk",
        "bulk-size": 5000,
        "indices": ["test-index"],
        "corpora": ["test_docs"]
      }
    }
  ]
}

```

I think it's a issue.

---

<div class="post-metadata">

**Author:** ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)\
**Post date:** [January 7, 2020, 10:00am UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660/4 "2020-01-07T10:00:02Z")

</div>

Hello,

I see the source of confusion.

If you use the `bulk` operation without a preceding [create-index](https://esrally.readthedocs.io/en/stable/track.html#create-index) operation, Rally will just [create the index](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html) (equivalent to `PUT /myindex`) specified in your corpora section, and rely on Elasticsearch version defaults: i.e. using [dynamic mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-mapping.html) and default [index settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings).

The [track you shared above](https://discuss.elastic.co/t/index-setting-is-not-work/213660/3) allows overriding index settings, but doesn't use the index body you mentioned in [your first post](https://discuss.elastic.co/t/index-setting-is-not-work/213660) as you aren't specifying the [body](https://esrally.readthedocs.io/en/stable/track.html#create-index) or have an [indices](https://esrally.readthedocs.io/en/stable/track.html#indices) section in the track.

Configurable settings/mappings (as jinja2 variables) should be specified in the index body.

The relevant doc parts show:

[create-index](https://esrally.readthedocs.io/en/stable/track.html#create-index):

> - `settings` (optional): Allows to specify additional index settings that will be merged with the index settings specified in the body of the index in the `indices` section.

[indices](https://esrally.readthedocs.io/en/stable/track.html#indices):

> - `body` (optional): File name of the corresponding index definition that will be used as body in the create index API call.

Dimitris

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 4, 2020, 10:00am UTC](https://discuss.elastic.co/t/index-setting-is-not-work/213660/5 "2020-02-04T10:00:24Z")

</div>

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