Esrally 在同一个 track.json 中提供多个搜索查询

时间:2021-07-21 06:17:51

标签: elasticsearch

我们能否在同一个 track.json 中给出多个搜索查询 我想给出下面给出的 2 个查询/所以我以不同的方式在几个地方添加了它来组织它。但是,当我验证 .json 时,我得到操作密钥重复或 json 无效。谢谢。

1 个答案:

答案 0 :(得分:0)

是参考https://esrally.readthedocs.io/en/stable/track.html#schedule 还有 https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/2

解决方案是

{
  "version": 2,
  "description": "Tutorial benchmark for Rally Search",
  "indices": [
    {
      "name": "customrecords",
      "types": [
        "docs"
      ]
    }
  ],
  "schedule": [
    {
      "operation": {
        "operation-type": "cluster-health",
        "request-params": {
          "wait_for_status": "green"
        }
      }
    },
    {
      "operation": {
        "name": "term-search",
        "operation-type": "search",
        "body": {
          "query": {
            "term": {
              "body": "Lago"
            }
          }
        }
      },
      "clients": 4,
      "warmup-iterations": 1000,
      "iterations": 6000,
      "target-throughput": 100
    },
    {
      "operation": {
        "name": "match-all-query",
        "operation-type": "search",
        "body": {
          "query": {
            "match_all": {}
          }
        }
      },
      "clients": 4,
      "warmup-iterations": 1000,
      "iterations": 6000,
      "target-throughput": 100
    }
  ]
}