Mapping

  • Defines how document and its fields are stored and indexed

  • Mapping can be derived dynamically by ElasticSearch

  • Handful core data types are supported

  • Mapping can be added to existing index for new fields

  • Existing field mapping not always possible to modify

  • ElasticSearch will derive mapping for new type and for new fields:

    curl -XPOST localhost:9200/orders/orders/1 \
    -H 'Content-Type: application/json' \
    -d '{"id": "1", "placedOn": "2016-10-17T13:03:30.830Z"}'
  • Retrieving existing mappings:

    curl 'localhost:9200/orders/orders/_mapping?pretty=true'
  • Expected response:

    ```

    {

    "orders" : {

    "mappings" : {

    "orders" : {
      "properties" : {
        "id" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "placedOn" : {
          "type" : "date"
        }
      }
    }

    }

    }

    }

```

Last updated

Was this helpful?