# Esrally giving multiple search queries in the same track.json

**URL:** <https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [July 20, 2021, 3:46pm UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184 "2021-07-20T15:46:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sameera\_De\_Silva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sameera_de_silva/32/91815_2.png) [@Sameera\_De\_Silva](https://discuss.elastic.co/u/Sameera_De_Silva)\
**Post date:** [July 20, 2021, 3:46pm UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/1 "2021-07-20T15:46:20Z")

</div>

Could we give multiple search queries in the same track.json  
I want to give 2 queries which given below/ So I added it in several places in different ways to organize it . However, when I validate the .json , I get operation key is duplicated or json is invalid. Thank you.

```auto
{
"operation": {
"name": "term-search",
"operation-type": "search",
"body": {
"query": {
"term": {
"body": "Lago"
}
}
}
}

Example-2

{
"operation": {
"name": "query-match-all",
"operation-type": "search",
"body": {
"query": {
"match_all": {}
}
}

```

---

<div class="post-metadata">

**Author:** ![RickBoyd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rickboyd/32/80022_2.png) [@RickBoyd](https://discuss.elastic.co/u/RickBoyd)\
**Post date:** [July 20, 2021, 3:56pm UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/2 "2021-07-20T15:56:56Z")

</div>

Hi! The `name` field should be in the task-level of the definition, not the operation-level:

```json
{
  //here
  "name": "my-task",
  "operation": {
  // not here
  ...
  }
}

```

By default, the task will just use the operation name (`search` in your case) as the task name, which means that they get duplicated in your configuration.

---

<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:** [July 20, 2021, 4:09pm UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/3 "2021-07-20T16:09:48Z")

</div>

As mentioned by @RickBoyd , please also make sure you've read this part of the documentation: [Track Reference — Rally 2.2.1 documentation](https://esrally.readthedocs.io/en/stable/track.html#schedule) that describes the different elements including examples.

---

<div class="post-metadata">

**Author:** ![Sameera\_De\_Silva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sameera_de_silva/32/91815_2.png) [@Sameera\_De\_Silva](https://discuss.elastic.co/u/Sameera_De_Silva)\
**Post date:** [July 21, 2021, 6:15am UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/4 "2021-07-21T06:15:00Z")

</div>

Thank you Rick and Dliappis, with your guidance I managed to solve the json errors and now the track.json is taken but it get finished within few seconds and seemed the test not ran. Below is the track.json that I used.

> {  
> "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"  
> }  
> }  
> }],  
> "operations": [{  
> "name": "term-search",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "term": {  
> "key\_architecture": "RODSozpcCCyoYXIUPIsAVfnoubWyYNcMFpWtbQkXxUxEeiNGKa"  
> }  
> }  
> }  
> },  
> {  
> "name": "match-all-query",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> }  
> ],  
> "clients": 8,  
> "warmup-iterations": 100,  
> "iterations": 5000,  
> "target-throughput": 20  
> }

---

<div class="post-metadata">

**Author:** ![Sameera\_De\_Silva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sameera_de_silva/32/91815_2.png) [@Sameera\_De\_Silva](https://discuss.elastic.co/u/Sameera_De_Silva)\
**Post date:** [July 22, 2021, 7:25am UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/5 "2021-07-22T07:25:27Z")

</div>

Below code is tested and passed and solved my need . Thank you all for the generous support and no further action is needed.

> {  
> "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  
> }  
> ]  
> }

---

<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:** [August 19, 2021, 7:26am UTC](https://discuss.elastic.co/t/esrally-giving-multiple-search-queries-in-the-same-track-json/279184/6 "2021-08-19T07:26:21Z")

</div>

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