Get the field capabilities
Generally available; Added in 5.4.0
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.
Required authorization
- Index privileges:
view_index_metadata
,read
Path parameters
-
A 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 targetingfoo*,bar*
returns an error if an index starts with foo but no index starts with bar. -
The 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
.Values are
all
,open
,closed
,hidden
, ornone
. -
A comma-separated list of fields to retrieve capabilities for. Wildcard (
*
) expressions are supported. -
If true, unmapped fields are included in the response.
-
A comma-separated list of filters to apply to the response.
-
A comma-separated list of field types to include. Any fields that do not match one of these types will be excluded from the results. It defaults to empty, meaning that all field types are returned.
-
If false, empty fields are not included in the response.
Body
-
An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation
POST my-index-*/_field_caps?fields=rating
{
"index_filter": {
"range": {
"@timestamp": {
"gte": "2018"
}
}
}
}
resp = client.field_caps(
index="my-index-*",
fields="rating",
index_filter={
"range": {
"@timestamp": {
"gte": "2018"
}
}
},
)
const response = await client.fieldCaps({
index: "my-index-*",
fields: "rating",
index_filter: {
range: {
"@timestamp": {
gte: "2018",
},
},
},
});
response = client.field_caps(
index: "my-index-*",
fields: "rating",
body: {
"index_filter": {
"range": {
"@timestamp": {
"gte": "2018"
}
}
}
}
)
$resp = $client->fieldCaps([
"index" => "my-index-*",
"fields" => "rating",
"body" => [
"index_filter" => [
"range" => [
"@timestamp" => [
"gte" => "2018",
],
],
],
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"index_filter":{"range":{"@timestamp":{"gte":"2018"}}}}' "$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating"
{
"index_filter": {
"range": {
"@timestamp": {
"gte": "2018"
}
}
}
}
{
"indices": [ "index1", "index2", "index3", "index4", "index5" ],
"fields": {
"rating": {
"long": {
"metadata_field": false,
"searchable": true,
"aggregatable": false,
"indices": [ "index1", "index2" ],
"non_aggregatable_indices": [ "index1" ]
},
"keyword": {
"metadata_field": false,
"searchable": false,
"aggregatable": true,
"indices": [ "index3", "index4" ],
"non_searchable_indices": [ "index4" ]
}
},
"title": {
"text": {
"metadata_field": false,
"searchable": true,
"aggregatable": false
}
}
}
}
{
"indices": [ "index1", "index2", "index3", "index4", "index5" ],
"fields": {
"rating": {
"long": {
"metadata_field": false,
"searchable": true,
"aggregatable": false,
"indices": [ "index1", "index2" ],
"non_aggregatable_indices": [ "index1" ]
},
"keyword": {
"metadata_field": false,
"searchable": false,
"aggregatable": true,
"indices": [ "index3", "index4" ],
"non_searchable_indices": [ "index4" ]
}
},
"title": {
"text": {
"metadata_field": false,
"searchable": true,
"aggregatable": false
}
}
}
}