FieldCaps
Updated at:2025-11-03
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
Text
1POST /<name>/_field_caps HTTP/1.1
2Host: <Endpoint>
3Authorization: <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
Text
1POST /my-index/_field_caps HTTP/1.1
2Host: bls-log.bj.baidubce.com
3Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
4Content-Type: application/json; charset=utf-8
5{
6 // Field collection: `*` wildcard is supported
7 "fields": ["*"]
8}
- Response example
Text
1// Success example
2{
3 // Index name
4 "indices": ["my-index"],
5 // Field information
6 "fields": {
7 // User field
8 "user": {
9 // Field type: keyword
10 // keyword: Keyword
11 // boolean: Bool type
12 // long: Integer type
13 // double: Float type
14 // object: Object type
15 "keyword": {
16 // Field type
17 "type": "keyword",
18 // Whether the field supports search
19 "searchable": true,
20 // Whether the field supports aggregation
21 "aggregatable": true,
22 // Whether the field is a metadata field
23 "metadata_field": false
24 }
25 },
26 "created_at": {
27 "date": {
28 "type": "date",
29 "searchable": true,
30 "aggregatable": true,
31 "metadata_field": false
32 }
33 },
34 "status": {
35 "keyword": {
36 "type": "keyword",
37 "searchable": true,
38 "aggregatable": true,
39 "metadata_field": false
40 }
41 }
42 }
43}
44// Exception example
45{
46 "error": {
47 "root_cause": [
48 {
49 "type": "action_request_validation_exception",
50 "reason": "action_request_validation_exception",
51 }
52 ],
53 "type": "action_request_validation_exception",
54 "reason": "action_request_validation_exception"
55 },
56 "status": 500
57}
