O'Reilly logo

Elasticsearch Server - Third Edition by Marek Rogoziński, Rafał Kuć

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Query rewrite

When debugging your queries, it is very valuable to know how all the queries are executed. Because of that, we decided to include the section on how query rewrite works in Elasticsearch, why it is used, and how to control it. If you have ever used queries, such as the prefix query and the wildcard query, basically any query that is said to be multiterm (a query that is built of multiple terms), you've used query rewriting even though you may not have known about it. Elasticsearch does rewrite for performance reasons. The rewrite process is about changing the original, expensive query into a set of queries that are far less expensive from an Apache Lucene point of view, thus speeding up the query execution.

Prefix query as an example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required