Search

An elastic search endpoint for Sefaria's data. Given a properly formated POST request this endpoint will return search results for appropriate Sefaria records.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
aggs
array of strings

List of fields to aggregate on. Common fields are path for the text type and group or topics for the sheet type

aggs
string
Defaults to naive_lemmatizer

The field you want to query. Common fields to query are exact or naive_lemmatizer for the text and merged indices. For querying the sheet index, commonly you'll query the content field

filter_fields
array

Must be the same length as filters. Each entry specifies the field to apply the corresponding filter in filters. For queries of type text this has no effect since there's only one field to filter text queries on (path. this field is explained in filters). For sheet queries, the following fields can appear in filter_fields: collections (corresponds to the collections that the sheet is in), topics_en (corresponds to the topics for this sheet, translated into English), topics_he (corresponds to the topics for this sheet, translated into Hebrew).

filter_fields
filters
array

A list of filters to filter results. These filters cannot include RegEx. Any RegEx characters will be escaped. Each filter is applied to the corresponding field in the filter_fields list. E.g. if filters is ["Passover", "Torah Talks"] and filter_fields is ["topics_en", "collections"] then the "Passover" filter will be applied to the "topics_en" field and the "Torah Talks" filter will be applied to the "collections" field. For text queries, filters always applies to the path field of documents. This essentially corresponds to the category path of the book in Sefaria's table of contents (there are some differences with regards to commentary paths). For sheet queries, filters can be applied to collections, topics_en or topics_he. These fields are explained in filter_fields param.

filters
string
Defaults to love

Your search query.

int32
Defaults to 10

For paginating results. The total number of results to return, starting from start

int32
Defaults to 10

The maximum distance between each query word in the resulting document. 0 means an exact match must be found

sort_fields
array of strings
Defaults to pagesheetrank

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 (which list results from titles published chronologically), order (which list results based on Sefaria's table of contents structure), pagesheetrank (most relevant results based on the Sheet Rank algorithm), dateCreated (for sheet results returned chronologically), views (for sheet results based on popularity).

sort_fields
string
enum
Defaults to score

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.

Allowed:
boolean

Whether or not to reverse the sort applied on sort_fields

double

The number used in case there is a value missing in your sort_field

boolean

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

string
enum
Defaults to text

The ElasticSearch index you want to query, and the results you expect to get back. sheet returns results from Sefaria's user generated source sheets, while text returns results from the library.

Allowed:
Response

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json