diff --git a/specification/_types/Errors.ts b/specification/_types/Errors.ts index 750a305525..6275b4ae27 100644 --- a/specification/_types/Errors.ts +++ b/specification/_types/Errors.ts @@ -38,7 +38,7 @@ export class ErrorCause /** * A human-readable explanation of the error, in English. */ - reason?: string + reason?: string | null /** * The server stack trace. Present only if the `error_trace=true` parameter was sent with the request. */ diff --git a/specification/_types/Retriever.ts b/specification/_types/Retriever.ts index 4b2f38a509..dc742ca4b8 100644 --- a/specification/_types/Retriever.ts +++ b/specification/_types/Retriever.ts @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ - import { QueryVector, QueryVectorBuilder, RescoreVector } from '@_types/Knn' import { float, integer } from '@_types/Numeric' import { Sort, SortResults } from '@_types/sort' import { FieldCollapse } from '@global/search/_types/FieldCollapse' +import { Rescore } from '@global/search/_types/rescoring' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' -import { Id } from './common' +import { Id, IndexName } from './common' import { QueryContainer } from './query_dsl/abstractions' /** @@ -39,6 +39,15 @@ export class RetrieverContainer { text_similarity_reranker?: TextSimilarityReranker /** A retriever that replaces the functionality of a rule query. */ rule?: RuleRetriever + /** A retriever that re-scores only the results produced by its child retriever. */ + rescorer?: RescorerRetriever + /** A retriever that supports the combination of different retrievers through a weighted linear combination. */ + linear?: LinearRetriever + /** + * A pinned retriever applies pinned documents to the underlying retriever. + * This retriever will rewrite to a PinnedQueryBuilder. + */ + pinned?: PinnedRetriever } export class RetrieverBase { @@ -46,6 +55,44 @@ export class RetrieverBase { filter?: QueryContainer | QueryContainer[] /** Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. */ min_score?: float + /** Retriever name. */ + _name?: string +} + +export class RescorerRetriever extends RetrieverBase { + /** Inner retriever. */ + retriever: RetrieverContainer + rescore: Rescore | Rescore[] +} + +export class LinearRetriever extends RetrieverBase { + /** Inner retrievers. */ + retrievers?: InnerRetriever[] + rank_window_size: integer +} + +export class PinnedRetriever extends RetrieverBase { + /** Inner retriever. */ + retriever: RetrieverContainer + ids?: string[] + docs?: SpecifiedDocument[] + rank_window_size: integer +} + +export class InnerRetriever { + retriever: RetrieverContainer + weight: float + normalizer: ScoreNormalizer +} + +export enum ScoreNormalizer { + none, + minmax +} + +export class SpecifiedDocument { + index?: IndexName + id: Id } export class StandardRetriever extends RetrieverBase { @@ -105,7 +152,7 @@ export class TextSimilarityReranker extends RetrieverBase { export class RuleRetriever extends RetrieverBase { /** The ruleset IDs containing the rules this retriever is evaluating against. */ - ruleset_ids: Id[] + ruleset_ids: Id | Id[] /** The match criteria that will determine if a rule in the provided rulesets should be applied. */ match_criteria: UserDefinedValue /** The retriever whose results rules should be applied to. */ diff --git a/specification/_types/query_dsl/fulltext.ts b/specification/_types/query_dsl/fulltext.ts index aa7ef2d91e..0885a508d3 100644 --- a/specification/_types/query_dsl/fulltext.ts +++ b/specification/_types/query_dsl/fulltext.ts @@ -103,6 +103,8 @@ export class IntervalsContainer { * Matches terms that start with a specified set of characters. */ prefix?: IntervalsPrefix + range?: IntervalsRange + regexp?: IntervalsRegexp /** * Matches terms using a wildcard pattern. */ @@ -232,6 +234,52 @@ export class IntervalsPrefix { use_field?: Field } +export class IntervalsRange { + /** + * Analyzer used to analyze the `prefix`. + * @doc_id analysis + */ + analyzer?: string + /** + * Lower term, either gte or gt must be provided. + */ + gte?: string + /** + * Lower term, either gte or gt must be provided. + */ + gt?: string + /** + * Upper term, either lte or lt must be provided. + */ + lte?: string + /** + * Upper term, either lte or lt must be provided. + */ + lt?: string + /** + * If specified, match intervals from this field rather than the top-level field. + * The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately. + */ + use_field?: Field +} + +export class IntervalsRegexp { + /** + * Analyzer used to analyze the `prefix`. + * @doc_id analysis + */ + analyzer?: string + /** + * Regex pattern. + */ + pattern: string + /** + * If specified, match intervals from this field rather than the top-level field. + * The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately. + */ + use_field?: Field +} + /** * @variants container * @ext_doc_id query-dsl-intervals-query @@ -259,6 +307,9 @@ export class IntervalsQuery extends QueryBase { * Matches terms that start with a specified set of characters. */ prefix?: IntervalsPrefix + range?: IntervalsRange + regexp?: IntervalsRegexp + /** * Matches terms using a wildcard pattern. */ diff --git a/specification/_types/query_dsl/geo.ts b/specification/_types/query_dsl/geo.ts index f4c31eec05..b2e077e698 100644 --- a/specification/_types/query_dsl/geo.ts +++ b/specification/_types/query_dsl/geo.ts @@ -97,7 +97,7 @@ export class GeoDistanceQuery /** @variants container */ export class GeoGridQuery extends QueryBase { - geogrid?: GeoTile + geotile?: GeoTile geohash?: GeoHash geohex?: GeoHexCell } diff --git a/specification/_types/query_dsl/specialized.ts b/specification/_types/query_dsl/specialized.ts index 7e9b81f734..9500abc36d 100644 --- a/specification/_types/query_dsl/specialized.ts +++ b/specification/_types/query_dsl/specialized.ts @@ -400,6 +400,7 @@ export class ShapeFieldQuery { */ export class RuleQuery extends QueryBase { organic: QueryContainer - ruleset_ids: Id[] + ruleset_ids?: Id | Id[] + ruleset_id?: string match_criteria: UserDefinedValue }