Get the field capabilities Added in 5.4.0

POST /{index}/_field_caps

Get information about the capabilities of fields among multiple indices.

For data streams, the API returns field capabilities among the stream’s backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family.

Path parameters

  • index string | array[string] Required

    Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

Query parameters

  • If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

  • expand_wildcards string | array[string]

    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • fields string | array[string]

    Comma-separated list of fields to retrieve capabilities for. Wildcard (*) expressions are supported.

  • If true, missing or closed indices are not included in the response.

  • If true, unmapped fields are included in the response.

  • filters string

    An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent

  • types array[string]

    Only return results for fields that have one of the types in the list

  • If false, empty fields are not included in the response.

application/json

Body

  • fields string | array[string]
  • Additional properties are allowed.

  • Hide runtime_mappings attribute Show runtime_mappings attribute object
    • * object Additional properties

      Additional properties are allowed.

      Hide * attributes Show * attributes object
      • fields object

        For type composite

        Hide fields attribute Show fields attribute object
        • * object Additional properties

          Additional properties are allowed.

          Hide * attribute Show * attribute object
          • type string Required

            Values are boolean, composite, date, double, geo_point, ip, keyword, long, or lookup.

      • fetch_fields array[object]

        For type lookup

        Hide fetch_fields attributes Show fetch_fields attributes object
        • field string Required

          Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

        • format string
      • format string

        A custom format for date type runtime fields.

      • Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • script object

        Additional properties are allowed.

        Hide script attributes Show script attributes object
        • source string

          The script source.

        • id string
        • params object

          Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

          Hide params attribute Show params attribute object
          • * object Additional properties

            Additional properties are allowed.

        • lang string

          Any of:

          Values are painless, expression, mustache, or java.

        • options object
          Hide options attribute Show options attribute object
          • * string Additional properties
      • type string Required

        Values are boolean, composite, date, double, geo_point, ip, keyword, long, or lookup.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • indices string | array[string] Required
    • fields object Required
      Hide fields attribute Show fields attribute object
      • * object Additional properties
        Hide * attribute Show * attribute object
        • * object Additional properties

          Additional properties are allowed.

          Hide * attributes Show * attributes object
          • aggregatable boolean Required

            Whether this field can be aggregated on all indices.

          • indices string | array[string]
          • meta object
            Hide meta attribute Show meta attribute object
            • * object Additional properties

              Additional properties are allowed.

          • non_aggregatable_indices string | array[string]
          • non_searchable_indices string | array[string]
          • searchable boolean Required

            Whether this field is indexed for search on all indices.

          • type string Required
          • Whether this field is registered as a metadata field.

          • time_series_dimension boolean Technical preview

            Whether this field is used as a time series dimension.

          • Values are gauge, counter, summary, histogram, or position.

          • non_dimension_indices array[string] Technical preview

            If this list is present in response then some indices have the field marked as a dimension and other indices, the ones in this list, do not.

          • metric_conflicts_indices array[string] Technical preview

            The list of indices where this field is present if these indices don’t have the same time_series_metric value for this field.

POST /{index}/_field_caps
curl \
 -X POST http://api.example.com/{index}/_field_caps \
 -H "Content-Type: application/json" \
 -d '{"fields":"string","index_filter":{},"runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}}}'
Request examples
{
  "fields": "string",
  "index_filter": {},
  "runtime_mappings": {
    "additionalProperty1": {
      "fields": {
        "additionalProperty1": {
          "type": "boolean"
        },
        "additionalProperty2": {
          "type": "boolean"
        }
      },
      "fetch_fields": [
        {
          "field": "string",
          "format": "string"
        }
      ],
      "format": "string",
      "input_field": "string",
      "target_field": "string",
      "target_index": "string",
      "script": {
        "source": "string",
        "id": "string",
        "params": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "": "painless",
        "options": {
          "additionalProperty1": "string",
          "additionalProperty2": "string"
        }
      },
      "type": "boolean"
    },
    "additionalProperty2": {
      "fields": {
        "additionalProperty1": {
          "type": "boolean"
        },
        "additionalProperty2": {
          "type": "boolean"
        }
      },
      "fetch_fields": [
        {
          "field": "string",
          "format": "string"
        }
      ],
      "format": "string",
      "input_field": "string",
      "target_field": "string",
      "target_index": "string",
      "script": {
        "source": "string",
        "id": "string",
        "params": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "": "painless",
        "options": {
          "additionalProperty1": "string",
          "additionalProperty2": "string"
        }
      },
      "type": "boolean"
    }
  }
}
Response examples (200)
{
  "indices": "string",
  "fields": {
    "additionalProperty1": {
      "additionalProperty1": {
        "aggregatable": true,
        "indices": "string",
        "meta": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "non_aggregatable_indices": "string",
        "non_searchable_indices": "string",
        "searchable": true,
        "type": "string",
        "metadata_field": true,
        "time_series_dimension": true,
        "time_series_metric": "gauge",
        "non_dimension_indices": [
          "string"
        ],
        "metric_conflicts_indices": [
          "string"
        ]
      },
      "additionalProperty2": {
        "aggregatable": true,
        "indices": "string",
        "meta": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "non_aggregatable_indices": "string",
        "non_searchable_indices": "string",
        "searchable": true,
        "type": "string",
        "metadata_field": true,
        "time_series_dimension": true,
        "time_series_metric": "gauge",
        "non_dimension_indices": [
          "string"
        ],
        "metric_conflicts_indices": [
          "string"
        ]
      }
    },
    "additionalProperty2": {
      "additionalProperty1": {
        "aggregatable": true,
        "indices": "string",
        "meta": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "non_aggregatable_indices": "string",
        "non_searchable_indices": "string",
        "searchable": true,
        "type": "string",
        "metadata_field": true,
        "time_series_dimension": true,
        "time_series_metric": "gauge",
        "non_dimension_indices": [
          "string"
        ],
        "metric_conflicts_indices": [
          "string"
        ]
      },
      "additionalProperty2": {
        "aggregatable": true,
        "indices": "string",
        "meta": {
          "additionalProperty1": {},
          "additionalProperty2": {}
        },
        "non_aggregatable_indices": "string",
        "non_searchable_indices": "string",
        "searchable": true,
        "type": "string",
        "metadata_field": true,
        "time_series_dimension": true,
        "time_series_metric": "gauge",
        "non_dimension_indices": [
          "string"
        ],
        "metric_conflicts_indices": [
          "string"
        ]
      }
    }
  }
}