Skip to content

Commit 731a76d

Browse files
Add descriptions for queries R-W (#2217)
* Add descriptions for queries R-W * Apply suggestions from code review Co-authored-by: István Zoltán Szabó <[email protected]> --------- Co-authored-by: István Zoltán Szabó <[email protected]>
1 parent b5e901e commit 731a76d

File tree

8 files changed

+698
-66
lines changed

8 files changed

+698
-66
lines changed

output/schema/schema.json

Lines changed: 238 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,35 @@ query-dsl-match-all-query,https://www.elastic.co/guide/en/elasticsearch/referenc
431431
query-dsl-match-bool-prefix-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-match-bool-prefix-query.html
432432
query-dsl-match-none-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-match-all-query.html#query-dsl-match-none-query
433433
query-dsl-match-query-phrase,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-match-query-phrase.html
434-
query-dsl-match-query-phrase-prefix,https://www.elastic.co/guide/en/elasticsearch/reference/query-dsl-mlt-query,{branch}/query-dsl-match-query-phrase-prefix.html
435-
https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-mlt-query.html
434+
query-dsl-match-query-phrase-prefix,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-match-query-phrase-prefix.html
435+
query-dsl-mlt-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-mlt-query.html
436436
query-dsl-multi-match-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-multi-match-query.html
437437
query-dsl-nested-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-nested-query.html
438438
query-dsl-parent-id-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-parent-id-query.html
439439
query-dsl-percolate-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-percolate-query.html
440440
query-dsl-pinned-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-pinned-query.html
441441
query-dsl-prefix-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-prefix-query.html
442-
query-dsl-query-string-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-query-string-query.html
442+
query-dsl-query-string-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-query-string-query.html
443+
query-dsl-range-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-range-query.html
444+
query-dsl-rank-feature-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-rank-feature-query.html
445+
query-dsl-regexp-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-regexp-query.html
446+
regexp-syntax,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/regexp-syntax.html
447+
query-dsl-script-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-script-query.html
448+
query-dsl-script-score-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-script-score-query.html
449+
query-dsl-shape-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-shape-query.html
450+
query-dsl-simple-query-string-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-simple-query-string-query.html
451+
query-dsl-span-containing-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-containing-query.html
452+
query-dsl-span-field-masking-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-field-masking-query.html
453+
query-dsl-span-first-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-first-query.html
454+
query-dsl-span-multi-term-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-multi-term-query.html
455+
query-dsl-span-near-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-near-query.html
456+
query-dsl-span-not-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-not-query.html
457+
query-dsl-span-or-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-or-query.html
458+
query-dsl-span-term-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-term-query.html
459+
query-dsl-span-within-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-span-within-query.html
460+
query-dsl-term-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-term-query.html
461+
query-dsl-terms-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-terms-query.html
462+
query-dsl-terms-set-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-terms-set-query.html
463+
query-dsl-text-expansion-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-text-expansion-query.html
464+
query-dsl-wildcard-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-wildcard-query.html
465+
query-dsl-wrapper-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-wrapper-query.html

specification/_types/Scripting.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,62 @@ import { Id } from './common'
2626
* @non_exhaustive
2727
*/
2828
export enum ScriptLanguage {
29+
/**
30+
* Painless scripting language, purpose-built for Elasticsearch.
31+
*/
2932
painless = 0,
33+
/**
34+
* Lucene’s expressions language, compiles a JavaScript expression to bytecode.
35+
*/
3036
expression = 1,
37+
/**
38+
* Mustache templated, used for templates.
39+
*/
3140
mustache = 2,
41+
/**
42+
* Expert Java API
43+
*/
3244
java = 3
3345
}
3446

3547
export class StoredScript {
48+
/**
49+
* Specifies the language the script is written in.
50+
*/
3651
lang: ScriptLanguage
3752
options?: Dictionary<string, string>
53+
/**
54+
* The script source.
55+
*/
3856
source: string
3957
}
4058

4159
export class ScriptBase {
60+
/**
61+
* Specifies any named parameters that are passed into the script as variables.
62+
* Use parameters instead of hard-coded values to decrease compile time.
63+
*/
4264
params?: Dictionary<string, UserDefinedValue>
4365
}
4466

4567
/** @shortcut_property source */
4668
export class InlineScript extends ScriptBase {
69+
/**
70+
* Specifies the language the script is written in.
71+
* @server_default painless
72+
*/
4773
lang?: ScriptLanguage
4874
options?: Dictionary<string, string>
75+
/**
76+
* The script source.
77+
*/
4978
source: string
5079
}
5180

5281
export class StoredScriptId extends ScriptBase {
82+
/**
83+
* The `id` for a stored script.
84+
*/
5385
id: Id
5486
}
5587

specification/_types/query_dsl/abstractions.ts

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,32 +265,123 @@ export class QueryContainer {
265265
* @doc_id query-dsl-query-string-query
266266
*/
267267
query_string?: QueryStringQuery
268+
/**
269+
* Returns documents that contain terms within a provided range.
270+
* @doc_id query-dsl-range-query
271+
*/
268272
range?: SingleKeyDictionary<Field, RangeQuery>
273+
/**
274+
* Boosts the relevance score of documents based on the numeric value of a `rank_feature` or `rank_features` field.
275+
* @doc_id query-dsl-rank-feature-query
276+
*/
269277
rank_feature?: RankFeatureQuery
278+
/**
279+
* Returns documents that contain terms matching a regular expression.
280+
* @doc_id query-dsl-regexp-query
281+
*/
270282
regexp?: SingleKeyDictionary<Field, RegexpQuery>
271283
rule_query?: RuleQuery
284+
/**
285+
* Filters documents based on a provided script.
286+
* The script query is typically used in a filter context.
287+
* @doc_id query-dsl-script-query
288+
*/
272289
script?: ScriptQuery
290+
/**
291+
* Uses a script to provide a custom score for returned documents.
292+
* @doc_id query-dsl-script-score-query
293+
*/
273294
script_score?: ScriptScoreQuery
295+
/**
296+
* Queries documents that contain fields indexed using the `shape` type.
297+
* @doc_id query-dsl-shape-query
298+
*/
274299
shape?: ShapeQuery
300+
/**
301+
* Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax.
302+
* @doc_id query-dsl-simple-query-string-query
303+
*/
275304
simple_query_string?: SimpleQueryStringQuery
305+
/**
306+
* Returns matches which enclose another span query.
307+
* @doc_id query-dsl-span-containing-query
308+
*/
276309
span_containing?: SpanContainingQuery
310+
/**
311+
* Wrapper to allow span queries to participate in composite single-field span queries by _lying_ about their search field.
312+
* @doc_id query-dsl-span-field-masking-query
313+
*/
277314
field_masking_span?: SpanFieldMaskingQuery
315+
/**
316+
* Matches spans near the beginning of a field.
317+
* @doc_id query-dsl-span-first-query
318+
*/
278319
span_first?: SpanFirstQuery
320+
/**
321+
* Allows you to wrap a multi term query (one of `wildcard`, `fuzzy`, `prefix`, `range`, or `regexp` query) as a `span` query, so it can be nested.
322+
* @doc_id query-dsl-span-multi-term-query
323+
*/
279324
span_multi?: SpanMultiTermQuery
325+
/**
326+
* Matches spans which are near one another.
327+
* You can specify `slop`, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
328+
* @doc_id query-dsl-span-near-query
329+
*/
280330
span_near?: SpanNearQuery
331+
/**
332+
* Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter `pre`) or y tokens after (controlled by the parameter `post`) another span query.
333+
* @doc_id query-dsl-span-not-query
334+
*/
281335
span_not?: SpanNotQuery
336+
/**
337+
* Matches the union of its span clauses.
338+
* @doc_id query-dsl-span-or-query
339+
*/
282340
span_or?: SpanOrQuery
341+
/**
342+
* Matches spans containing a term.
343+
* @doc_id query-dsl-span-term-query
344+
*/
283345
span_term?: SingleKeyDictionary<Field, SpanTermQuery>
346+
/**
347+
* Returns matches which are enclosed inside another span query.
348+
* @doc_id query-dsl-span-within-query
349+
*/
284350
span_within?: SpanWithinQuery
351+
/**
352+
* Returns documents that contain an exact term in a provided field.
353+
* To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization.
354+
* @doc_id query-dsl-term-query
355+
*/
285356
term?: SingleKeyDictionary<Field, TermQuery>
357+
/**
358+
* Returns documents that contain one or more exact terms in a provided field.
359+
* To return a document, one or more terms must exactly match a field value, including whitespace and capitalization.
360+
* @doc_id query-dsl-terms-query
361+
*/
286362
terms?: TermsQuery
363+
/**
364+
* Returns documents that contain a minimum number of exact terms in a provided field.
365+
* To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization.
366+
* @doc_id query-dsl-terms-set-query
367+
*/
287368
terms_set?: SingleKeyDictionary<Field, TermsSetQuery>
288369
/**
370+
* Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a rank features field.
289371
* @availability stack since=8.8.0
290372
* @availability serverless
373+
* @doc_id query-dsl-text-expansion-query
291374
*/
292375
text_expansion?: SingleKeyDictionary<Field, TextExpansionQuery>
376+
/**
377+
* Returns documents that contain terms matching a wildcard pattern.
378+
* @doc_id query-dsl-wildcard-query
379+
*/
293380
wildcard?: SingleKeyDictionary<Field, WildcardQuery>
381+
/**
382+
* A query that accepts any other query as base64 encoded string.
383+
* @doc_id query-dsl-wrapper-query
384+
*/
294385
wrapper?: WrapperQuery
295386

296387
/**
@@ -372,7 +463,10 @@ export class CombinedFieldsQuery extends QueryBase {
372463
}
373464

374465
export class WrapperQuery extends QueryBase {
375-
/** A base64 encoded query. The binary data format can be any of JSON, YAML, CBOR or SMILE encodings */
466+
/**
467+
* A base64 encoded query.
468+
* The binary data format can be any of JSON, YAML, CBOR or SMILE encodings
469+
*/
376470
query: string
377471
}
378472

specification/_types/query_dsl/fulltext.ts

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,37 +706,125 @@ export class QueryStringQuery extends QueryBase {
706706
export type SimpleQueryStringFlags = SimpleQueryStringFlag | string
707707

708708
export enum SimpleQueryStringFlag {
709+
/**
710+
* Disables all operators.
711+
*/
709712
NONE = 1,
713+
/**
714+
* Enables the `+` AND operator.
715+
*/
710716
AND = 2,
717+
/**
718+
* Enables the `\|` OR operator.
719+
*/
711720
OR = 4,
721+
/**
722+
* Enables the `-` NOT operator.
723+
*/
712724
NOT = 8,
725+
/**
726+
* Enables the `*` prefix operator.
727+
*/
713728
PREFIX = 16,
729+
/**
730+
* Enables the `"` quotes operator used to search for phrases.
731+
*/
714732
PHRASE = 32,
733+
/**
734+
* Enables the `(` and `)` operators to control operator precedence.
735+
*/
715736
PRECEDENCE = 64,
737+
/**
738+
* Enables `\` as an escape character.
739+
*/
716740
ESCAPE = 128,
741+
/**
742+
* Enables whitespace as split characters.
743+
*/
717744
WHITESPACE = 256,
745+
/**
746+
* Enables the `~N` operator after a word, where `N` is an integer denoting the allowed edit distance for matching.
747+
*/
718748
FUZZY = 512,
749+
/**
750+
* Enables the `~N` operator, after a phrase where `N` is the maximum number of positions allowed between matching tokens.
751+
* Synonymous to `SLOP`.
752+
*/
719753
NEAR = 1024,
754+
/**
755+
* Enables the `~N` operator, after a phrase where `N` is maximum number of positions allowed between matching tokens.
756+
* Synonymous to `NEAR`.
757+
*/
720758
SLOP = 2048,
759+
/**
760+
* Enables all optional operators.
761+
*/
721762
ALL = 4096
722763
}
723764

724765
export class SimpleQueryStringQuery extends QueryBase {
766+
/**
767+
* Analyzer used to convert text in the query string into tokens.
768+
* @doc_id analysis
769+
*/
725770
analyzer?: string
726-
/** @server_default false */
771+
/**
772+
* If `true`, the query attempts to analyze wildcard terms in the query string.
773+
* @server_default false
774+
*/
727775
analyze_wildcard?: boolean
728-
/** @server_default true */
776+
/**
777+
* If `true`, the parser creates a match_phrase query for each multi-position token.
778+
* @server_default true
779+
*/
729780
auto_generate_synonyms_phrase_query?: boolean
730-
/** @server_default 'or' */
781+
/**
782+
* Default boolean logic used to interpret text in the query string if no operators are specified.
783+
* @server_default 'or'
784+
*/
731785
default_operator?: Operator
786+
/**
787+
* Array of fields you wish to search.
788+
* Accepts wildcard expressions.
789+
* You also can boost relevance scores for matches to particular fields using a caret (`^`) notation.
790+
* Defaults to the `index.query.default_field index` setting, which has a default value of `*`.
791+
*/
732792
fields?: Field[]
793+
/**
794+
* List of enabled operators for the simple query string syntax.
795+
* @server_default ALL
796+
*/
733797
flags?: SimpleQueryStringFlags
798+
/**
799+
* Maximum number of terms to which the query expands for fuzzy matching.
800+
* @server_default 50
801+
*/
734802
fuzzy_max_expansions?: integer
803+
/**
804+
* Number of beginning characters left unchanged for fuzzy matching.
805+
* @server_default 0
806+
*/
735807
fuzzy_prefix_length?: integer
808+
/**
809+
* If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
810+
*/
736811
fuzzy_transpositions?: boolean
737-
/** @server_default false */
812+
/**
813+
* If `true`, format-based errors, such as providing a text value for a numeric field, are ignored.
814+
* @server_default false
815+
*/
738816
lenient?: boolean
817+
/**
818+
* Minimum number of clauses that must match for a document to be returned.
819+
* @doc_id query-dsl-minimum-should-match
820+
*/
739821
minimum_should_match?: MinimumShouldMatch
822+
/**
823+
* Query string in the simple query string syntax you wish to parse and use for search.
824+
*/
740825
query: string
826+
/**
827+
* Suffix appended to quoted text in the query string.
828+
*/
741829
quote_field_suffix?: string
742830
}

0 commit comments

Comments
 (0)