Link Search Menu Expand Document Documentation Menu

You're viewing version 2.15 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Constant keyword field type

A constant keyword field uses the same value for all documents in the index.

When a search request spans multiple indexes, you can filter on a constant keyword field to match documents from indexes with the given constant value but not from indexes with a different value.

Example

The following query creates a mapping with a constant keyword field:

PUT romcom_movies
{
  "mappings" : {
    "properties" : {
      "genre" : {
        "type": "constant_keyword",
        "value" : "Romantic comedy"
      }
    }
  }
}

Parameters

The following table lists the parameters accepted by constant keyword field types. All values are required.

Parameter Description
value The string field value for all documents in the index.
350 characters left

Have a question? .

Want to contribute? or .