{% raw %}{% import "benchmark.helpers" as benchmark with context %}{% endraw %}
{
  "version": 2,
  "description": "Tracker-generated workload for {{workload_name}}",
  "indices": [{% set comma = joiner() %}{% for index in indices %}{{comma()}}
    {
      "name": "{{index.name}}",
      "body": "{{index.filename}}"
    }{% endfor %}
  ],
  "corpora": [{% set comma = joiner() %}{% for corpus in corpora %}{{comma()}}
    {
      "name": "{{corpus.index_name}}",
      "documents": [
        {
          "target-index": "{{corpus.index_name}}",
          "source-file": "{{corpus.filename}}",
          "document-count": {{corpus.doc_count}},
          "compressed-bytes": {{corpus.compressed_bytes}},
          "uncompressed-bytes": {{corpus.uncompressed_bytes}}
        }
      ]
    }{% endfor %}
  ],
  "schedule": [
    {
      "operation": "delete-index"
    },{% raw %}
    {
      "operation": {
        "operation-type": "create-index",
        "settings": {{index_settings | default({}) | tojson}}
      }
    },{% endraw %}
    {
      "operation": {
        "operation-type": "cluster-health",
        "index": {{ indices | map(attribute='name') | list | join(',') | tojson }},{% raw %}
        "request-params": {
          "wait_for_status": "{{cluster_health | default('green')}}",
          "wait_for_no_relocating_shards": "true"
        },
        "retry-until-success": true
      }
    },
    {
      "operation": {
        "operation-type": "bulk",
        "bulk-size": {{bulk_size | default(5000)}},
        "ingest-percentage": {{ingest_percentage | default(100)}}
      },
      "clients": {{bulk_indexing_clients | default(8)}}
    }
  ]{% endraw %}
}
