Skip to content

Search endpoint fixes #4420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions specification/_global/search/_types/highlighting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Dictionary } from '@spec_utils/Dictionary'
import { Dictionary, SingleKeyDictionary } from '@spec_utils/Dictionary'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { Field, Fields } from '@_types/common'
import { integer } from '@_types/Numeric'
Expand Down Expand Up @@ -151,7 +151,9 @@ export class HighlightBase {

export class Highlight extends HighlightBase {
encoder?: HighlighterEncoder
fields: Dictionary<Field, HighlightField>
fields:
| SingleKeyDictionary<Field, HighlightField>
| SingleKeyDictionary<Field, HighlightField>[]
}

export enum HighlighterEncoder {
Expand Down
2 changes: 1 addition & 1 deletion specification/_types/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
11 changes: 10 additions & 1 deletion specification/_types/Retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { FieldCollapse } from '@global/search/_types/FieldCollapse'
import { Rescore } from '@global/search/_types/rescoring'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { QueryVector, QueryVectorBuilder, RescoreVector } from '@_types/Knn'
import { float, integer } from '@_types/Numeric'
Expand All @@ -39,6 +40,8 @@ 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
}

export class RetrieverBase {
Expand All @@ -48,6 +51,12 @@ export class RetrieverBase {
min_score?: float
}

export class RescorerRetriever extends RetrieverBase {
/** Inner retriever. */
retriever: RetrieverContainer
rescore: Rescore | Rescore[]
}

export class StandardRetriever extends RetrieverBase {
/** Defines a query to retrieve a set of top documents. */
query?: QueryContainer
Expand Down Expand Up @@ -105,7 +114,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. */
Expand Down
4 changes: 2 additions & 2 deletions specification/_types/query_dsl/WeightedTokensQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Dictionary } from '@spec_utils/Dictionary'
import { SingleKeyDictionary } from '@spec_utils/Dictionary'
import { float } from '@_types/Numeric'
import { QueryBase } from './abstractions'
import { TokenPruningConfig } from './TokenPruningConfig'
Expand All @@ -27,7 +27,7 @@ import { TokenPruningConfig } from './TokenPruningConfig'
*/
export class WeightedTokensQuery extends QueryBase {
/** The tokens representing this query */
tokens: Dictionary<string, float>
tokens: SingleKeyDictionary<string, float>[]
/** Token pruning configurations */
pruning_config?: TokenPruningConfig
}
51 changes: 51 additions & 0 deletions specification/_types/query_dsl/fulltext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion specification/_types/query_dsl/geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class GeoDistanceQuery

/** @variants container */
export class GeoGridQuery extends QueryBase {
geogrid?: GeoTile
geotile?: GeoTile
geohash?: GeoHash
geohex?: GeoHexCell
}
Expand Down
3 changes: 2 additions & 1 deletion specification/_types/query_dsl/specialized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading