Sameera De Silva
2 min readJul 22, 2021

Esrally how to send multiple search queries in a track.

For that could use below code, it has 2 search queries as operations and it’s own iterations as well.

please also make sure you’ve read this part of the documentation: Track Reference — Rally 2.2.1 documentation

Save the file as track.json and use the below command in Centos to run it.

nohup /usr/local/bin/esrally — track-path=/home/usernamefolder/samfiles — target-hosts=https://demo-site.tools — pipeline=benchmark-only — client-options=”use_ssl:true,verify_certs:false,basic_auth_user:’username’,basic_auth_password:’password’,timeout:120" >> rally_stdout.log 2>> rally_stderr.log < /dev/null &

{
"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": {
"key_architecture": "RODSozpcCCyoYXIUPIsAVfnoubWyYNcMFpWtbQkXxUxEeiNGKa"
}
}
}
},
"clients": 4,
"warmup-iterations": 1000,
"iterations": 4500,
"target-throughput": 100
},
{
"operation": {
"name": "match-all-query",
"operation-type": "search",
"body": {
"query": {
"match_all": {}
}
}
},
"clients": 4,
"warmup-iterations": 1000,
"iterations": 4500,
"target-throughput": 100
},
{
"operation": {
"name": "past-sixtymins-query",
"operation-type": "search",
"body": {
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "now-90d",
"lte": "now"
}
}
}
}
}
}
},
"clients": 4,
"warmup-iterations": 1000,
"iterations": 4500,
"target-throughput": 100
},
{
"operation": {
"name": "must-query-with-time-filter",
"operation-type": "search",
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"description.keyword": "desccrption 1034"
}
}
],
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-90d",
"lte": "now"
}
}
}
]
}
}
}
},
"clients": 4,
"warmup-iterations": 1000,
"iterations": 4500,
"target-throughput": 100
},
{
"operation": {
"name": "String-query",
"operation-type": "search",
"body": {
"query": {
"query_string": {
"default_field": "key1",
"query": "sNYhzYdjkwjeVVunliSVMwxpaJAoDbpf",
"default_operator": "AND"
}
}
}
},
"clients": 4,
"warmup-iterations": 1000,
"iterations": 4500,
"target-throughput": 100
}
]
}

Queries run in sequential mode

If ran without issues , in results both queries should be displayed.

Test result

No responses yet