What is the equivalent of creating MySQL indexes in Elasticsearch?


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 :wink:

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

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?

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...

Kind of? By default all the fields are indexed so that isn't a thing you have to do. You can actually turn off 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 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 which lets you trade index size for speed. Geo has similar things, iirc.

If you want to learn more, go read the mapping docs.