How can I create multi-index by ---track-params?


(jianxiong) #1

Now, the configuration file track.json is:

{% set index_count = 3 %}
{
  "version": 2,
  "description": "max throughput with {{index_count}} index",
  "indices": [
    {% set comma = joiner() %}
    {% for item in range(index_count) %}
    {{ comma() }}
    {
      "name": "billions-jssz.benchmark.scene1-{{item}}",
      "body": "settings/mapping.json",
      "types": [ "logs" ]
    }
    {% endfor %}
  ],
...

when I want to change the number of indices,I have to rewrite the index_count at line 1. But I just want to change it by --track-params, just like: --track-params=params.json:

{
    "index_count": 5
}

I am not good at Jinja, so how should I write the track.json,please?


(Dimitrios Liappis) #2

Hi,

You can directly use the value specified for index_count in your params.json, but of course, right now you track is hard coding it to the value 3.

If you still want to keep a default value you could do something like:

{% if index_count is not defined %}
{% set index_count = 3 %}
{% endif %}

this should allow the use of custom values for index_count in your params.json.

See also: http://jinja.pocoo.org/docs/2.10/templates/#defined

Rgs,
Dimitris


(jianxiong) #3

I have tryed, it works.
Thanks a lot !:grinning:


(system) #4

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