Skip to content

Latest commit

 

History

History
44 lines (42 loc) · 1.3 KB

File metadata and controls

44 lines (42 loc) · 1.3 KB

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"
          }
        }
      }
    }
  }
}