Elasticsearch
is a secondary database. It holds a copy of the properties of every element for the , one index per type (node_<lowercase label> or relation_<lowercase type>). It never holds the only copy of a value, see why Elasticsearch is .
Elasticsearch 8.12 or newer is required, e.g. for kNN queries inside of search queries. Versions up to 9.5 are tested.
What it stores
Every property is copied and indexed, unless the property or its type sets "search": false, see . This differs from Neo4j and MongoDB, which only index what a schema asks for: Elasticsearch is the search engine of the API, so it is optimized for common search queries without any definition. The mapping of a property follows its , e.g. geo_point for points and dense_vector for vectors, and can be replaced with a raw Elasticsearch . Files are not copied.
Written documents become searchable after the next refresh, about one second after the write.
Limits
- 1000 fields per index: Elasticsearch counts every mapped field of an index, including nested properties and the
keywordsub-fields of strings, and rejects mappings with more thanindex.mapping.total_fields.limitfields, 1000 by default. A schema with many properties, or with deeply nested objects, can therefore make its migration step fail. Raise the setting of the index in Elasticsearch before the migration is run, or exclude properties from the search with"search": false. - 20 levels of nesting: objects can be mapped at most
index.mapping.depth.limitlevels deep, 20 by default. - 4096 dimensions per vector:
dense_vectorfields have at most 4096 dimensions, see . - Long keywords: the
keywordsub-field of strings, and thekeywordfield of a string with onlyexact, ignore values of more than 256 characters (ignore_above). Such values can not be found by their exact value, only by the words of thetextfield, if the string has one. A raw Elasticsearch mapping can set another limit.
Migrations
Creating the index and adding fields or dynamic templates is not left to migrations alone: it is also done when a schema is saved and after a backup , so that the index never starts with a dynamic mapping (the steps create-elasticsearch-index and update-elasticsearch-mapping). If the plan contains a blocking step, e.g. because of an incompatible field, nothing is applied to Elasticsearch, and errors are logged and do not fail the save. A creates the index of the type (node_<lowercase label> or relation_<lowercase type>) with the mapping of the schema if it does not exist, and adds fields which the schema defines but the index does not have. Fields are never removed. Existing fields which do not match the schema (e.g. a string property, whose existing field is a number) can not be changed in place: the plan contains a step which fails with a description, fix the data or the schema, or reindex manually. This also applies to a changed index or similarity of a vector, to changed parameters of a raw elasticsearch mapping (only the parameters which the schema sets are compared), and to a missing keyword sub field of a field which asks for both exact and fulltext. Properties without raw settings accept the mappings which Elasticsearch created on its own for the same values. Objects with "additionalProperties": false are mapped dynamic: strict, and the typed additionalProperties of objects become dynamic templates (named ember_<path>), so that further properties are mapped as defined. Dynamic templates which were not created by schemas are never touched. Failing steps, for incompatible fields and for indices which the version can not provide (e.g. bit vectors need Elasticsearch 8.15), are blocking and run before any step of any database, so nothing has changed when they fail.