ApiSearchRequest Data Type

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).

Properties
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:
  • Some text fields, e.g. production.spatial.nation or birthPlace.
  • Fully facetable date fields, e.g. production.createdDate or birthDate. Returns multiple aspects for each date field:
    • dayOfTheWeek: The day of the week, e.g. "Monday"
    • monthOfYear: The month of the year, e.g. "February"
    • year: The proleptic year without year 0, including era (if BCE), e.g. "2015" or "200 BCE"
    • decadeOfCentury: The decade of the century, e.g. "1920s"
    • century: The century, including era (if BCE) e.g. "13th century" or "2nd century BCE"
    • era: The full era, "Common Era" (CE) or "Before Common Era" (BCE)
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"
  } ]
}