{% extends BASE_TEMPLATE %} {% block title %}API Search Help{% endblock %} {% block breadcrumbs %}
{% endblock %} {% block content %}There are two ways to use the search API: URL query parameters and the Elasticsearch query JSON.
Search API uses HTTP GET with filters as URL params.
The fulltext field uses Elasticsearch query_string syntax. DDR field names are searchable via this method. Note: Wildcards at the beginning of a word (eg "*ing") are ignored.
Search queries can also be composed using a subset of the Elasticsearch query syntax and POSTed to the search API URL.
{
"fulltext": "FULL TEXT SEARCH HERE",
"must": [ ...AND queries... ],
"should": [ ...OR queries... ],
"mustnot": [ ...NOT queries... ],
"models": [],
"sort": ["field1", "field2"],
"limit": 25,
"offset": 0
}
Subqueries are formatted like Elasticsearch query dicts
{"match": {"fieldname": "value"}}
{"multi_match": {
"query": "full text search",
"fields": ["fieldname1", "fieldname2"]
}}
{"terms": {"fieldname": ["value1","value2"]}},
{"range": {"fieldname": {"gt":20, "lte":31}}},
{"exists": {"fieldname": "title"}}
{"missing": {"fieldname": "title"}}
For example, the role field below would be referred to as creators.role.
{
"creators": [
{
"namepart": "Hirabayashi, Gordon",
"role": "author"
},
...