# What is the equivalent of creating MySQL indexes in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872>\
**Category:** Elasticsearch\
**Created:** [April 30, 2016, 6:17pm UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872 "2016-04-30T18:17:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hayder\_Abbass](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayder_abbass/32/4559_2.png) [@Hayder\_Abbass](https://discuss.elastic.co/u/Hayder_Abbass)\
**Post date:** [April 30, 2016, 6:17pm UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/1 "2016-04-30T18:17:55Z")

</div>

Hello!

As you probably know, in MySQL you can create indexes to improve the performance of your queries. Is there any such equivalent in Elastic? I have gone through the entire documentation, and I'm pretty sure there is no such thing. (I already know that an index is somewhat the equivalent of creating a database in Elastic)

I just need confirmation from some black belt Elastic users 😉

---

<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:** [April 30, 2016, 7:11pm UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/2 "2016-04-30T19:11:05Z")

</div>

Elastic creates indices for all fields by default.  
Don't worry 🙂

---

<div class="post-metadata">

**Author:** ![Hayder\_Abbass](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayder_abbass/32/4559_2.png) [@Hayder\_Abbass](https://discuss.elastic.co/u/Hayder_Abbass)\
**Post date:** [May 1, 2016, 7:57am UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/3 "2016-05-01T07:57:31Z")

</div>

Yes, I know there's a default template for this. But my question is, performance-wise, is there any such thing as creating an index to improve performance just like in MySQL?

---

<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:** [May 1, 2016, 8:27am UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/4 "2016-05-01T08:27:32Z")

</div>

Elasticsearch IS an index. So your question does not really make sense or I don't get it.

You don't have to create an index on an index...

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 2, 2016, 2:11pm UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/5 "2016-05-02T14:11:04Z")

</div>

> [@Hayder\_Abbass](#):
>
> But my question is, performance-wise, is there any such thing as creating an index to improve performance just like in MySQL?

Kind of? By default all the fields are indexed so that isn't a thing you have to do. You can actually [turn off](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/mapping-index.html) indexing if you want to save space. Unlike MySQL there isn't a convenient way to fall back to a table scan if you don't have an index. A [script query](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/query-dsl-script-query.html) is sort of like asking for a table scan but you have to use it explicitly.

As far as things you can tune, I can only think of [precision\_step](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/precision-step.html) which lets you trade index size for speed. Geo has similar things, iirc.

If you want to learn more, go read the [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/mapping.html) docs.

---

<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:** [July 5, 2017, 10:54pm UTC](https://discuss.elastic.co/t/what-is-the-equivalent-of-creating-mysql-indexes-in-elasticsearch/48872/6 "2017-07-05T22:54:38Z")

</div>


