# What is the difference in specifying the index in the URL with specifying the index in the query body?

**URL:** https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910
**Category:** Elasticsearch
**Created:** [October 16, 2019, 6:45pm UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910 "2019-10-16T18:45:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Henrique\_Brasileiro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrique_brasileiro/32/51630_2.png) [@Henrique\_Brasileiro](https://discuss.elastic.co/u/Henrique_Brasileiro)
#### Post date: [October 16, 2019, 6:45pm UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910/1 "2019-10-16T18:45:55Z")

</div>

I want to undenstand the performance diference between:

GET /\_search

```
{
     "query": {
         "terms": {
             "_index": ["index_1", "index_2"] 
           }
      }
}

```

and:

GET index\_1,index\_2/\_search

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 17, 2019, 7:47am UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910/2 "2019-10-17T07:47:40Z")

</div>

I have no idea but I'd definitely use the later.

---

<div class="post-metadata">

### Author: ![Henrique\_Brasileiro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrique_brasileiro/32/51630_2.png) [@Henrique\_Brasileiro](https://discuss.elastic.co/u/Henrique_Brasileiro)
#### Post date: [October 17, 2019, 10:23am UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910/3 "2019-10-17T10:23:54Z")

</div>

My problem consist in the limit of the URL that is 4096 bytes, I have to much indexes and I want to limit the number of shards that query touch.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 17, 2019, 12:19pm UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910/4 "2019-10-17T12:19:17Z")

</div>

Did you consider using aliases?

---

<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: [November 14, 2019, 12:20pm UTC](https://discuss.elastic.co/t/what-is-the-difference-in-specifying-the-index-in-the-url-with-specifying-the-index-in-the-query-body/203910/5 "2019-11-14T12:20:34Z")

</div>

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