Elasticsearch - Indices
Indices are containers for mapping types. An Elasticsearch index is an independent
chunk of documents, much like a database is in the relational world: each index is
stored on the disk in the same set of files; it stores all the fields from all the mapping
types in there, and it has its own settings. For example, each index has a setting called
refresh_interval, which defines the interval at which newly indexed documents are
made available for searches. This refresh operation is quite expensive in terms of per-
formance, and this is why it’s done occasionally—by default, every second—instead of
doing it after each indexed document. If you’ve read that Elasticsearch is near-real-time,
this refresh process is what it refers to.
TIP Just as you can search across types, you can search across indices. This
gives you flexibility in the way you can organize documents. For example, you
can put your get-together events and the blog posts about them in different
indices or in different types of the same index. Some ways are more efficient
than others, depending on your use case.
One example of index-specific settings is the number of shards. An index can be made up of one or more chunks called shards. This is good for
scalability: you can run Elasticsearch on multiple servers and have shards of the
same index live on all of them. Next, we’ll take a closer look at how sharding works
in Elasticsearch.
chunk of documents, much like a database is in the relational world: each index is
stored on the disk in the same set of files; it stores all the fields from all the mapping
types in there, and it has its own settings. For example, each index has a setting called
refresh_interval, which defines the interval at which newly indexed documents are
made available for searches. This refresh operation is quite expensive in terms of per-
formance, and this is why it’s done occasionally—by default, every second—instead of
doing it after each indexed document. If you’ve read that Elasticsearch is near-real-time,
this refresh process is what it refers to.
TIP Just as you can search across types, you can search across indices. This
gives you flexibility in the way you can organize documents. For example, you
can put your get-together events and the blog posts about them in different
indices or in different types of the same index. Some ways are more efficient
than others, depending on your use case.
One example of index-specific settings is the number of shards. An index can be made up of one or more chunks called shards. This is good for
scalability: you can run Elasticsearch on multiple servers and have shards of the
same index live on all of them. Next, we’ll take a closer look at how sharding works
in Elasticsearch.
Comments
Post a Comment