Search API (v2)

Lev Eliezer Israel edited this page Jan 28, 2019 · 4 revisions

POST /api/search-wrapper

Simpler search API than Search API (v1) which exposes the main search functionality available on the site. Your POST should include the Content-Type: application/json; charset=utf-8 header. In the POST body, you can include the following keys:

query str (required): Your search query

type one_of('text', 'sheet', 'merged') (required): The index you want to query. See Search API (v2)#Index Types for an explanation of each index

field str (default=exact): the field you want to query. Common fields to query are exact or naive_lemmatizer for the text and merged indexes. For querying the sheets index, commonly you'll query the content field

source_proj bool, str or list(str) (default=False) by default, the ElasticSearch document is not returned. Specifying True will return the entire document. Specifying a str or list(str) will perform a projection on the document for the specified fields

slop int (default=0) the maximum distance between each query word in the resulting document. 0 means an exact match must be found

start int (default=0) for paginating results. The number document to start returning. 0 means start at the first result

size int (default=100) for paginating results. The total number of results to return, starting from start

filters list(str) (default=[]) a list of filters to filter results. These filters can be RegEx if querying the text index. For the sheet type, the filters are applied literally. Each filter is applied to its corresponding entry in the filter_fields list

filter_fields list(str) (default=[] required if filters is specified): Must be the same length as filters. Each entry specifies the field to apply the corresponding filter in filters

aggs list(str) (default=[]): list of field to aggregate on. Common fields are path for the text type and group or tags for the sheet type

sort_method one_of('sort', 'score') (default=sort) how to sort results. If sort the values are sorted according to sort_fields. If score, the value in sort_fields is multiplied with the default ElasticSearch score.

sort_fields list(str): list of fields to sort on. If sort_method = 'score' this list should have exactly one item. Common fields to sort on are comp_date, order, pagesheetrank, dateCreated, views`

sort_reverse bool (default=False): whether or not to reverse the sort applied on sort_fields

sort_score_missing float (default=0): the number used in case there is a value missing in your sort_field

Return value

The API returns results in the standard ElasticSearch format. See Search API (v1) for a brief explanation

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.