Common REST parameters
To convert output units to human-readable values (for example, for 1 hour and 1kb
for 1,024 bytes), add ?human=true
to the request URL.
The following request requires response values to be in human-readable format:
Pretty result
To get back JSON responses in a readable format, add ?pretty=true
to the request URL.
Example request
GET <index_name>/_search?pretty=true
To specify the type of content in the request body, use the key name in the request header. Most operations support JSON, YAML, and CBOR formats.
The following request specifies JSON format for the request body:
Request body in query string
If the client library does not accept a request body for non-POST requests, use the source
query string parameter to pass the request body. Also, specify the source_content_type
parameter with a supported media type such as application/json
.
Example request
To include the error stack trace in the response when an exception is raised, add error_trace=true
to the request URL.
The following request sets error_trace
to true
so that the response returns exception-triggered errors:
Filtered responses
To reduce the response size use the filter_path
parameter to filter the fields that are returned. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with -
.