Enabled

The enabled parameter allows you to control whether OpenSearch parses the contents of a field. This parameter can be applied to the top-level mapping definition and to object fields.

The enabled parameter accepts the following values.

ParameterDescription
trueThe field is parsed and indexed. Default is true.
falseThe field is not parsed or indexed but is still retrievable from the _source field. When enabled is set to false, OpenSearch stores the field’s value in the _source field but does not index or parse its contents. This can be useful for fields that you want to store but do not need to search, sort, or aggregate on.

Example: Using the enabled parameter

In the following example request, the session_data field is disabled. OpenSearch stores its contents in the _source field but does not index or parse them:

  1. PUT my-index-002
  2. {
  3. "mappings": {
  4. "properties": {
  5. "user_id": {
  6. "type": "keyword"
  7. },
  8. "last_updated": {
  9. "type": "date"
  10. },
  11. "session_data": {
  12. "type": "object",
  13. "enabled": false
  14. }
  15. }
  16. }
  17. }

copy