Analysis is the process of converting full text to terms. Depending on which analyzer is used, these phrases:
foo,barwill probably all result in the terms
bar. These terms are what is actually stored in the index.
A full text query (not a term query) for
FoO:bARwill also be analyzed to the terms
barand will thus match the terms stored in the index.
It is this process of analysis (both at index time and at search time) that allows Elasticsearch to perform full text queries.
- A cluster consists of one or more nodes which share the same cluster name. Each cluster has a single master node which is chosen automatically by the cluster and which can be replaced if the current master node fails.
- cross-cluster replication (CCR)
- The cross-cluster replication feature enables you to replicate indices in remote clusters to your local cluster. For more information, see Cross-cluster replication.
- cross-cluster search (CCS)
- The cross-cluster search feature enables any node to act as a federated client across multiple clusters. See Cross-cluster search.
A document is a JSON document which is stored in Elasticsearch. It is like a row in a table in a relational database. Each document is stored in an index and has a type and an id.
A document is a JSON object (also known in other languages as a hash / hashmap / associative array) which contains zero or more fields, or key-value pairs.
The original JSON document that is indexed will be stored in the
_sourcefield, which is returned by default when getting or searching for a document.
A document contains a list of fields, or key-value pairs. The value can be a simple (scalar) value (eg a string, integer, date), or a nested structure like an array or an object. A field is similar to a column in a table in a relational database.
The mapping for each field has a field type (not to be confused with document type) which indicates the type of data that can be stored in that field, eg
object. The mapping also allows you to define (amongst other things) how the value for a field should be analyzed.
- A filter is a non-scoring query, meaning that it does not score documents. It is only concerned about answering the question - "Does this document match?". The answer is always a simple, binary yes or no. This kind of query is said to be made in a filter context, hence it is called a filter. Filters are simple checks for set inclusion or exclusion. In most cases, the goal of filtering is to reduce the number of documents that have to be examined.
- follower index
- Follower indices are the target indices for cross-cluster replication. They exist in your local cluster and replicate leader indices.
The ID of a document identifies a document. The
index/idof a document must be unique. If no ID is provided, then it will be auto-generated. (also see routing)
An index is like a table in a relational database. It has a mapping which contains a type, which contains the fields in the index.
An index is a logical namespace which maps to one or more primary shards and can have zero or more replica shards.
- leader index
- Leader indices are the source indices for cross-cluster replication. They exist on remote clusters and are replicated to follower indices.
A mapping is like a schema definition in a relational database. Each index has a mapping, which defines a type, plus a number of index-wide settings.
A mapping can either be defined explicitly, or it will be generated automatically when a document is indexed.
A node is a running instance of Elasticsearch which belongs to a cluster. Multiple nodes can be started on a single server for testing purposes, but usually you should have one node per server.
At startup, a node will use unicast to discover an existing cluster with the same cluster name and will try to join that cluster.
- primary shard
Each document is stored in a single primary shard. When you index a document, it is indexed first on the primary shard, then on all replicas of the primary shard.
By default, an index has 5 primary shards. You can specify fewer or more primary shards to scale the number of documents that your index can handle.
You cannot change the number of primary shards in an index, once the index is created.
See also routing
- A query is the basic component of a search. A search can be defined by one or more queries which can be mixed and matched in endless combinations. While filters are queries that only determine if a document matches, those queries that also calculate how well the document matches are known as "scoring queries". Those queries assign it a score, which is later used to sort matched documents. Scoring queries take more resources than non scoring queries and their query results are not cacheable. As a general rule, use query clauses for full-text search or for any condition that requires scoring, and use filters for everything else.
- replica shard
Each primary shard can have zero or more replicas. A replica is a copy of the primary shard, and has two purposes:
- increase failover: a replica shard can be promoted to a primary shard if the primary fails
- increase performance: get and search requests can be handled by primary or replica shards.
By default, each primary shard has one replica, but the number of replicas can be changed dynamically on an existing index. A replica shard will never be started on the same node as its primary shard.
When you index a document, it is stored on a single primary shard. That shard is chosen by hashing the
routingvalue. By default, the
routingvalue is derived from the ID of the document or, if the document has a specified parent document, from the ID of the parent document (to ensure that child and parent documents are stored on the same shard).
This value can be overridden by specifying a
routingvalue at index time, or a routing field in the mapping.
A shard is a single Lucene instance. It is a low-level “worker” unit which is managed automatically by Elasticsearch. An index is a logical namespace which points to primary and replica shards.
Other than defining the number of primary and replica shards that an index should have, you never need to refer to shards directly. Instead, your code should deal only with an index.
Elasticsearch distributes shards amongst all nodes in the cluster, and can move shards automatically from one node to another in the case of node failure, or the addition of new nodes.
- source field
By default, the JSON document that you index will be stored in the
_sourcefield and will be returned by all get and search requests. This allows you access to the original object directly from search results, rather than requiring a second step to retrieve the object from an ID.
A term is an exact value that is indexed in Elasticsearch. The terms
FOOare NOT equivalent. Terms (i.e. exact values) can be searched for using term queries.
Text (or full text) is ordinary unstructured text, such as this paragraph. By default, text will be analyzed into terms, which is what is actually stored in the index.
Text fields need to be analyzed at index time in order to be searchable as full text, and keywords in full text queries must be analyzed at search time to produce (and search for) the same terms that were generated at index time.
A type used to represent the type of document, e.g. an
user, or a
tweet. Types are deprecated and are in the process of being removed. See Removal of mapping types.
Intro to Kibana
ELK for Logs & Metrics