|
| 1 | +/* |
| 2 | + * Licensed to Elasticsearch B.V. under one or more contributor |
| 3 | + * license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright |
| 5 | + * ownership. Elasticsearch B.V. licenses this file to you under |
| 6 | + * the Apache License, Version 2.0 (the "License"); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +import { SingleKeyDictionary } from '@spec_utils/Dictionary' |
| 21 | +import { Field } from '@_types/common' |
| 22 | +import { BoolQuery } from '@_types/query_dsl/compound' |
| 23 | +import { SortResults } from '@_types/sort' |
| 24 | +import { |
| 25 | + ExistsQuery, |
| 26 | + IdsQuery, |
| 27 | + PrefixQuery, |
| 28 | + RangeQuery, |
| 29 | + TermQuery, |
| 30 | + TermsQuery, |
| 31 | + WildcardQuery |
| 32 | +} from '@_types/query_dsl/term' |
| 33 | +import { MatchQuery, SimpleQueryStringQuery } from '@_types/query_dsl/fulltext' |
| 34 | +import { MatchAllQuery } from '@_types/query_dsl/MatchAllQuery' |
| 35 | +import { User } from '@security/_types/User' |
| 36 | + |
| 37 | +/** |
| 38 | + * @variants container |
| 39 | + * @non_exhaustive |
| 40 | + */ |
| 41 | +export class UserQueryContainer { |
| 42 | + /** |
| 43 | + * Returns users based on their IDs. |
| 44 | + * This query uses the user document IDs stored in the `_id` field. |
| 45 | + * @doc_id query-dsl-ids-query |
| 46 | + */ |
| 47 | + ids?: IdsQuery |
| 48 | + /** |
| 49 | + * matches users matching boolean combinations of other queries. |
| 50 | + * @doc_id query-dsl-bool-query |
| 51 | + */ |
| 52 | + bool?: BoolQuery |
| 53 | + /** |
| 54 | + * Returns users that contain an indexed value for a field. |
| 55 | + * @doc_id query-dsl-exists-query |
| 56 | + */ |
| 57 | + exists?: ExistsQuery |
| 58 | + /** |
| 59 | + * Returns users that match a provided text, number, date or boolean value. |
| 60 | + * The provided text is analyzed before matching. |
| 61 | + * @doc_id query-dsl-match-query |
| 62 | + */ |
| 63 | + match?: SingleKeyDictionary<Field, MatchQuery> |
| 64 | + /** |
| 65 | + * Matches all users, giving them all a `_score` of 1.0. |
| 66 | + * @doc_id query-dsl-match-all-query |
| 67 | + */ |
| 68 | + match_all?: MatchAllQuery |
| 69 | + /** |
| 70 | + * Returns users that contain a specific prefix in a provided field. |
| 71 | + * @doc_id query-dsl-prefix-query |
| 72 | + */ |
| 73 | + prefix?: SingleKeyDictionary<Field, PrefixQuery> |
| 74 | + /** |
| 75 | + * Returns users that contain terms within a provided range. |
| 76 | + * @doc_id query-dsl-range-query |
| 77 | + */ |
| 78 | + range?: SingleKeyDictionary<Field, RangeQuery> |
| 79 | + /** |
| 80 | + * Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. |
| 81 | + * @doc_id query-dsl-simple-query-string-query |
| 82 | + */ |
| 83 | + simple_query_string?: SimpleQueryStringQuery |
| 84 | + /** |
| 85 | + * Returns users that contain an exact term in a provided field. |
| 86 | + * To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. |
| 87 | + * @doc_id query-dsl-term-query |
| 88 | + */ |
| 89 | + term?: SingleKeyDictionary<Field, TermQuery> |
| 90 | + /** |
| 91 | + * Returns users that contain one or more exact terms in a provided field. |
| 92 | + * To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. |
| 93 | + * @doc_id query-dsl-terms-query |
| 94 | + */ |
| 95 | + terms?: TermsQuery |
| 96 | + /** |
| 97 | + * Returns users that contain terms matching a wildcard pattern. |
| 98 | + * @doc_id query-dsl-wildcard-query |
| 99 | + */ |
| 100 | + wildcard?: SingleKeyDictionary<Field, WildcardQuery> |
| 101 | +} |
| 102 | + |
| 103 | +export class QueryUser extends User { |
| 104 | + _sort?: SortResults |
| 105 | +} |
0 commit comments