Feb 19, 2013
Nick Zadrozny
•
Guides
•
3
min read
One of Elasticsearch’s biggest strengths is the ease of creating many indexes. It’s just a simple HTTP POST, and you’re ready to start indexing documents!
<pre><code>curl -X POST http://index.bonsai.io/blog-development curl -X POST http://index.bonsai.io/blog-staging curl -X POST http://index.bonsai.io/blog-production </code></pre>
Using many indexes for your application is very useful, particularly for scaling. When you have a lot of data, you can use many kinds of natural partitioning points in order to flexibly create many small indexes, which can be easier to scale than a single monolithic index.Some examples of why an app may need many indexes:
<pre><code>curl -X POST http://index.bonsai.io/events-day0 curl -X POST http://index.bonsai.io/events-day1 curl -X POST http://index.bonsai.io/events-day2 </code></pre>
Storing your data into multiple indexes is only as useful as getting your documents back out of those indexes. Toward that end, Elasticsearch has excellent support for multi-index querying. Present since its earliest versions, a multi-index search provides multiple index names in the search request, separated by commas:
<pre><code>curl http://index.bonsai.io/authors,articles,comments/_search This is a useful feature for, e.g., the Tire Ruby client, which partitions separate models into their own indexes by default:</code></pre>
<pre><code>Tire.index('authors,articles,comments').search do # ... end </code></pre>
Because of the design of our systems, we don’t always support 100% of Elasticsearch’s API (see our new FAQ for more reasons why). However, as of today, you can now query your indexes with basic multi-index search syntax.
Reserved for future implementation work is the more advanced wildcard and operator syntax, introduced in Elasticsearch 0.19.8. Both are being worked on with a careful eye on ensuring proper security and privacy of the indexes in our clusters.
If you need this, or any other Elasticsearch feature, let us know! We are a small, focused development team and prioritize our plans based on input from our customers.
Schedule a free consultation to see how we can create a customized plan to meet your search needs.