Mapping

Index mapping is used to describe the shape and format of our document data.

Create mapping - Request

To add a mapping into newly created index, issue an HTTP POST request into the Index API:

/v1/indices/{indexId}/mapping

Replace indexId with an id of an index that was created in the previous step.

In the request body, describe the types of your data fields:

{
 "id": {
  "type": "keyword"
 },
 "rating": {
  "type": "integer"
 },
 "title": {
  "type": "text"
 },
 "category": {
  "type": "text_keyword"
 }
}

For a full reference of available property types, see: Mapping.

Important notes:

  • id field is always required and is used to uniquely identify your documents.
  • Full text search can only be used on text properties;
  • Sorting, filtering and faceting is only allowed for numerical and keyword properties;
  • If you need to use sorting, filtering and faceting on text properties, use a special text_keyword type.
  • If any property value needs to have multiple values per document, there is no need for any special configuration, as Lupa will accept any property as a single value or an array.

Create mapping - Response

If mapping is configured correctly, the API returns a success response:

{
  "success": true
}

Next steps

It's time to import some Documents into your index:

Continue

See also: