# Esrally when gave "index": "\_all", it executes search queries on all the indices instead of search only the defined indices

**URL:** <https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [August 2, 2021, 10:31am UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207 "2021-08-02T10:31: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:** [August 2, 2021, 10:31am UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/1 "2021-08-02T10:31:20Z")

</div>

I have a requirement to do a simultaneous multiple search query execution in 3 indices . So I defiend them in below track.json and added "index": "\_all",

as per the answer of [Can't configure multiple indices on which to run a benchmarkin RALLY](https://discuss.elastic.co/t/cant-configure-multiple-indices-on-which-to-run-a-benchmarkin-rally/70281)

Problem is that now all the indices get searched , not just the 3 indices which I already defined. Kindly help. Here is my track.json

> {  
> "version": 2,  
> "description": "Tutorial benchmark for Rally Search",  
> "indices": [  
> {  
> "name": "geocustom",  
> "types": [  
> "docs"  
> ]  
> },  
> {  
> "name": "customrecords",  
> "types": [  
> "docs"  
> ]  
> },  
> {  
> "name": "banks",  
> "types": [  
> "docs"  
> ]  
> }  
> ],  
> "schedule": [  
> {  
> "parallel": {  
> "clients": 4,  
> "warmup-iterations": 1000,  
> "iterations": 4000,  
> "tasks": [  
> {  
> "operation": {  
> "name": "01-term-search",  
> "index": "\_all",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "term": {  
> "key\_architecture": "RODSozpcCCyoYXIUPIsAVfnoubWyYNcMFpWtbQkXxUxEeiNGKa"  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "index": "\_all",  
> "name": "02-match-all-query",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "03-past-sixtymins-query",  
> "index": "\_all",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "bool": {  
> "filter": {  
> "range": {  
> "@timestamp": {  
> "gte": "now-90d",  
> "lte": "now"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "04-must-query-with-time-filter",  
> "index": "\_all",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "match": {  
> "description.keyword": "desccrption 1034"  
> }  
> }  
> ],  
> "filter": [  
> {  
> "range": {  
> "@timestamp": {  
> "gte": "now-90d",  
> "lte": "now"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "05-String-query AND",  
> "index": "\_all",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "query\_string": {  
> "default\_field": "key1",  
> "query": "sNYhzYdjkwjeVVunliSVMwxpaJAoDbpf",  
> "default\_operator": "AND"  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "06-String-query-OR",  
> "index": "\_all",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "query\_string": {  
> "default\_field": "key1",  
> "query": "700 701",  
> "default\_operator": "OR"  
> }  
> }  
> }  
> }  
> }  
> ]  
> }  
> }  
> ]  
> }

---

<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:** [August 2, 2021, 11:55am UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/2 "2021-08-02T11:55:14Z")

</div>

> [@Sameera\_De\_Silva](#):
>
> "index": "\_all",

So, why do you specify `_all` and not a list of the indices you actually want to search?

---

<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:** [August 2, 2021, 12:38pm UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/3 "2021-08-02T12:38:19Z")

</div>

When I gave without it , below error throwed.

> Running 01-term-search,02-match-all-query,03-past-sixtymins-query,04-mu... [0% done]
> 
> [ERROR] Cannot race. Error in load generator (("'index' is mandatory and is miss ing for operation '01-term-search'", None)

---

<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:** [August 2, 2021, 1:08pm UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/4 "2021-08-02T13:08:49Z")

</div>

> [@Sameera\_De\_Silva](#):
>
> When I gave without it , below error throwed.

Please check the docs for the [search operation type](https://esrally.readthedocs.io/en/stable/track.html#id6). You'll find out that you can pass an [index pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html). In the last link you'll find details about using the multi-target index syntax.

---

<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:** [August 4, 2021, 5:04am UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/5 "2021-08-04T05:04:58Z")

</div>

Thank you , you are a life saver. it worked . I created indexes as pref-index-01,pref-index-02 and 03. Just passed this "name": "pref-index-\*" so it picks all the ones that I mentioned early.

> {  
> "version": 2,  
> "description": "Tutorial benchmark for Rally Search",  
> "indices": [  
> {  
> "name": "pref-index-\*",  
> "types": [  
> "docs"  
> ]  
> }  
> ],  
> "schedule": [  
> {  
> "parallel": {  
> "clients": 4,  
> "warmup-iterations": 1000,  
> "iterations": 40000,  
> "tasks": [  
> {  
> "operation": {  
> "name": "01-term-search",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "term": {  
> "key\_architecture": "RODSozpcCCyoYXIUPIsAVfnoubWyYNcMFpWtbQkXxUxEeiNGKa"  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "02-match-all-query",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "03-size-limit--match-all-query",  
> "operation-type": "search",  
> "size": 100,  
> "body": {  
> "query": {  
> "match\_all": {}  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "04-past-sixtymins-query",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "bool": {  
> "filter": {  
> "range": {  
> "@timestamp": {  
> "gte": "now-90d",  
> "lte": "now"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "05-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"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "06-String-query AND",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "query\_string": {  
> "default\_field": "key1",  
> "query": "sNYhzYdjkwjeVVunliSVMwxpaJAoDbpf",  
> "default\_operator": "AND"  
> }  
> }  
> }  
> }  
> },  
> {  
> "operation": {  
> "name": "07-String-query-OR",  
> "operation-type": "search",  
> "body": {  
> "query": {  
> "query\_string": {  
> "default\_field": "key1",  
> "query": "700 701",  
> "default\_operator": "OR"  
> }  
> }  
> }  
> }  
> }  
> ]  
> }  
> }  
> ]  
> }

---

<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:** [September 1, 2021, 5:05am UTC](https://discuss.elastic.co/t/esrally-when-gave-index-all-it-executes-search-queries-on-all-the-indices-instead-of-search-only-the-defined-indices/280207/6 "2021-09-01T05:05:12Z")

</div>

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