Check a search without running it
POST /v1/validate_search
Checks the body exactly as POST /v1/search would, and answers with the search as it
would run: every default filled in, and from and to evaluated to instants, with
now the time the request arrives. Nothing is searched. A search that would be
refused is refused here in the same way (see Checking before you send).
Responses
200 · Success
The search is valid, and this is how it would run now.
termstringmay be absentWhat to search for, as a term expression (see Search terms). To search for a text literally, put a backslash before every
"and\in it and wrap it in double quotes. Optional: without it, a search finds every document that passes its filters, newest first (see Searching without a term). How long it may be depends on your organization's agreement. A term that does not parse is refused with400, and each mistake'sspanmarks where it is (see problem types).strategystringmay be absentHow the term is matched and ranked. Required with
term, and refused without one.headline: the term must match the headline.body: the term must match the headline or the body, and a match in the headline ranks higher.
Each text in the term is matched in one language. A text with a Chinese character in it is matched against the Chinese:
zh.headlineas the headline, the Chinese text as the body, including Chinese text thathiddensays is left out. Any other text is matched against the English:en.titleas the headline,en.summaryas the body, since there is no English full text.With both, relevance falls off with the distance of the chosen date (
dateField) fromto. Neither strategy changes significantly or is removed in/v1. New strategies may be added.typeInlist of stringsmay be absentOnly documents of these kinds. Without it, all kinds.
levelInlist of stringsmay be absentOnly documents issued at these levels. Without it, all levels.
issuerInlist of stringsmay be absentOnly documents from these issuers. Without it, all issuers.
topicInlist of stringsmay be absentOnly documents on these topics. Without it, all topics.
fromstringThe earliest instant of
dateFieldthe search would include.tostringThe instant of
dateFieldthe search would stop before.dateFieldstringWhich of a document's dates
fromandtofilter on and the time histogram counts.dateis the one date each document is treated as having. The others are the members ofdates, and each finds only documents that have that date. The ranking uses the chosen date too (seestrategyand Searching without a term).pageSizeinteger, 0 to 100How many summaries each page of a search holds. With
0, a search returnshitsand the histograms asked for, no summaries, and nonext.histogramsobjectmay be absentThe histograms asked for, each with its options' defaults filled in, so
"time": {}comes back as{"time": {"timeZone": "UTC"}}. Absent when none were asked for. A histogram may come to have options your client does not know yet, with their defaults.
Errors
Every error is a problem document with the fields below. Its type names the problem, and is the address of the problem's page.
- 400
invalid-request The request is not valid (
invalid-request): a path that cannot be read, a body that is not JSON or does not match the schema, an unknown field, afromortothat is not a valid instant expression (an unknown time zone, or a time of day the zone skips, included), afromthat is not earlier thanto, atermthat does not parse or is longer than your organization's agreement allows, an unknown issuer, a scope in the body that does not exist, or a saved search's name that breaks the naming rule.errorsnames each offending part: apointerinto the body (for the run of a saved search, intoparametersas it ran), or theparameterof the path (see problem types).- 401
unauthenticated No access token, or one that is invalid or has expired (
unauthenticated). Refresh the access token and try again.- Header
WWW-AuthenticateBearer, as RFC 6750 on another website specifies.
- Header
- 403
no-organizationmultiple-organizationsorganization-not-registerednot-entitledaccess-endedtier-served-elsewhererange-not-entitledsuspended The account may not do this.
typesays why: a refusal every operation can meet (no-organization,multiple-organizations,organization-not-registered,not-entitled,access-ended,tier-served-elsewhereorsuspended, see Problem types), or the search reaches further than the organization's agreement allows (range-not-entitled, with the earliest allowedfrominearliestFrom, the latest allowedtoinlatestTo, and anerrorsentry pointing at each end at fault).- 413
payload-too-large The request body is too large (
payload-too-large).- 415
unsupported-media-type The request body is not
application/json(unsupported-media-type).- 429
rate-limited Too many requests, or too many at the same time (
rate-limited), from your account, your organization, or your network address. Wait forRetry-Afterseconds, then send the same request again.- Header
Retry-AfterHow many seconds to wait before sending the same request again.
- Header
- 431
headers-too-large The request's headers are too large (
headers-too-large). An access token is far below the limit, so look for a header your client adds.- 503
unavailable The API is temporarily unavailable (
unavailable), because our servers are under pressure or briefly out of service. Wait forRetry-Afterseconds, then send the same request again.- Header
Retry-AfterHow many seconds to wait before sending the same request again.
- Header
A problem document's fields
typestringIdentifies the problem; branch on this. One of the problem types under
https://api.reconnectchina.org/docs/v1/problems/, named in each response's description and itsx-problem-types, and listed in Problem types, for examplehttps://api.reconnectchina.org/docs/v1/problems/continuation-expired. The URL is also the type's documentation.titlestringA short, human-readable summary of the problem type.
statusintegerThe HTTP status code.
detailstringmay be absentA human-readable explanation of this occurrence.
errorslist of objectsmay be absentFor
invalid-request, each part of the request that is not valid, and forrange-not-entitled, each end of the range that reaches too far. Each names the part in exactly one way:pointerfor a part of the body,parameterfor a part of the path. A part with several mistakes in it, such as aterm, has an entry for each, andspansays where in it each one is.parameterstringmay be absentThe name of the path parameter, as this document names it, for example
namein/v1/saved_searches/{scope}/{name}.pointerstringmay be absentA JSON Pointer (RFC 6901 on another website) into the request body, for example
/levelIn/0. Empty for the body as a whole. For the run of a saved search, it points into the search as it ran, as if the body had been{"parameters": …}with the saved parameters and your overrides:/parameters/fromwhetherfromwas saved or sent.spanobjectmay be absentWhere in a string a problem is: the characters from
startup to, not including,end, counting from 0. Characters are Unicode code points, asmaxLengthcounts them, so低空经济is four; a program that marks text in another unit converts, such as a browser, whose strings count a character outside the Basic Multilingual Plane as two. Equalstartandendmark the place where something is missing, such as the end of a term that stops after&&.startinteger, at least 0endinteger, at least 0detailstringearliestFromstring, up to 128 charactersmay be absentFor
range-not-entitled, the earliestfromyour organization may use, as an instant expression such asnow-1yor1900-01-01.latestTostring, up to 128 charactersmay be absentFor
range-not-entitled, the latesttoyour organization may use, as an instant expression such as3000-01-01.serverstringmay be absentFor
tier-served-elsewhere, the server of this API that your account may use, one ofservers, such ashttps://sandbox.api.reconnectchina.org.