Mapping is the process of defining how a JSON document and the fields it contains are stored and indexed in Elasticsearch. There are various field types offered by Elasticsearch which you can assign to the fields that will be stored in Elasticsearch.

Mappings are immutable in Elasticsearch. Once a mapping type is assigned to a field, it can be only modified by re-indexing the data with the new mapping type.

Appbase.io's Schema UI (earlier called App Settings) lets you do the following:

  • Add a new field and set its data type,
  • In addition to a data type, you can also set the use-case for each field as either search or aggregation,
  • You can update the data type of an existing field,
  • You can delete an existing field.

Once you make schema changes, appbase.io does an in place re-index of the data.

Field Data Types

Field data types are present in one of three shapes:

  1. Primitive: Text, Keyword, Integer, Float, Double, Date, Geo Point, Boolean are some examples.

  2. Array: An array shape in appbase.io is just a container that can hold one or more values of the primitive data type. There is no special data type associated with it.

  3. Object: An object shape in appbase.io acts as a container that can hold a nested JSON object, each keys of which representing a primitive data type or another object / array container.

Beyond the primitive data types, there are also specialized data types that are specific to a search engine, like completion, ip, percolator. You can read all about the supported data types over here.

How to Set Mappings

In addition to the Schema UI described above, you can use:

  1. Data Browser: The data browser UI can be used to set mappings via the Add New Field UI button.

The UI supports adding all the primitive types. You can set your own mapping object for creating a specialized type or if you want to set any non-default options within a type.

  1. REST API: You can use the REST API to set the mappings using the PUT /_mapping endpoint.

Note

Mappings are immutable in Elasticsearch. Once set, they can't be changed.