A search request allows an API consumer to specify a search query, including a number of facets, and a sort order.
If using the advanced search endpoint, the pagination parameters must be passed through this object (the request body).
| name | data type | constraints | description |
|---|---|---|---|
| query | string | The search query to use (e.g. as entered by the user). The query string is expected to be a valid Elastic Search query string. Defaults to "*". |
|
| defaultOperator | Operator | The default boolean operator to use on terms in the search query (optional). Defaults to "OR". | |
| from | number | required int | Requested page. The first result to include in the response. Defaults to 0. |
| size | number | required int | Requested page size. The number of results to return. Use -1 for maximum size. Defaults to 10. |
| fields | array of SourceField | Comma-separated list of fields to include/exclude in each result record (optional). Add a "-" prefix to a field name to exclude it; use no prefix to include it. Defaults to empty (i.e. include all fields). |
|
| facets | array of Facet | Facets (optional).
Only supports top-N term facets on:
|
|
| filters | array of Filter | Filters (optional). Supports keyword filtering on all facetable fields. | |
| sort | array of Sort | Sort order of the results (optional).
Defaults to descending relevance score.
Only some text fields are supported. |
Example
{
"query" : "James Cook",
"defaultOperator" : "AND",
"from" : 25,
"size" : 10,
"fields" : [ {
"include" : true,
"field" : "title",
"exclude" : true
}, {
"include" : true,
"field" : "_meta.*",
"exclude" : false
} ],
"facets" : [ {
"field" : "birthPlace",
"size" : 3
}, {
"field" : "birthDate",
"size" : 5
} ],
"filters" : [ {
"field" : "birthPlace",
"keyword" : "London"
}, {
"field" : "birthDate",
"keyword" : "1987"
} ],
"sort" : [ {
"field" : "title",
"order" : "asc"
}, {
"field" : "_meta.modified",
"order" : "desc"
} ]
}