FieldCaps
Last Updated:2025-11-14
Description
Get index field list
API restriction
- Only path parameters and the fields request body field are supported for input; other parameters are not supported, such as query parameters like expand_wildcards, ignore_unavailable, allow_no_indices, include_unmapped, filters, types, include_empty_fields, and request body parameters like index_filter and runtime_mappings
- The field information in the response result only includes four fields: type, searchable, aggregatable, and metadata_field; no other information is included
Request
- Request syntax
POST /<name>/_field_caps HTTP/1.1
Host: <Endpoint>
Authorization: <Authorization String>- Request headers
No additional headers are required beyond the standard request headers.
- Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| name | String | Yes | Path | Index name: Fuzzy matching is not supported |
| fields | List<String> | Yes | RequestBody | Index field name: Supports fuzzy matching with * wildcard |
Successful response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| indices | List<String> | Index list: Currently contains only one element |
| fields | Map<String, Map<String, Field>> | Index fields: The relationship between field name, field type, and field metadata |
The element structure of Field object in the above table is as follows:
| Field | Types | Description |
|---|---|---|
| type | String | Field type. Values: keyword: Keyword; boolean: Bool type; long: Integer type; double: Float type; object: Object type |
| searchable | bool | Whether the field supports search: true: Supported; false: Not supported |
| aggregatable | bool | Whether the field supports aggregation: true: Supported; false: Not supported |
| metadata_field | bool | Whether the field is a metadata field: true: Yes; false: No |
Anomaly response
- Response headers
No additional headers are required beyond the standard response headers.
- Response parameters
| Field | Types | Description |
|---|---|---|
| error | Error | Error reason |
| status | Int | HTTP status code: e.g., 500 |
The element structure of Error object in the above table is as follows:
| Field | Types | Description |
|---|---|---|
| root_cause | List<Error> | Root cause |
| type | String | Error type |
| reason | String | Error reason |
Example
- Request example
POST /my-index/_field_caps HTTP/1.1
Host: bls-log.bj.baidubce.com
Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
Content-Type: application/json; charset=utf-8
{
// Field collection: `*` wildcard is supported
"fields": ["*"]
}- Response example
// Success example
{
// Index name
"indices": ["my-index"],
// Field information
"fields": {
// User field
"user": {
// Field type: keyword
// keyword: Keyword
// boolean: Bool type
// long: Integer type
// double: Float type
// object: Object type
"keyword": {
// Field type
"type": "keyword",
// Whether the field supports search
"searchable": true,
// Whether the field supports aggregation
"aggregatable": true,
// Whether the field is a metadata field
"metadata_field": false
}
},
"created_at": {
"date": {
"type": "date",
"searchable": true,
"aggregatable": true,
"metadata_field": false
}
},
"status": {
"keyword": {
"type": "keyword",
"searchable": true,
"aggregatable": true,
"metadata_field": false
}
}
}
}
// Exception example
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "action_request_validation_exception",
}
],
"type": "action_request_validation_exception",
"reason": "action_request_validation_exception"
},
"status": 500
}