diff --git a/docs/reference/es_compatible_api.md b/docs/reference/es_compatible_api.md index 3302e85826..de8994a87e 100644 --- a/docs/reference/es_compatible_api.md +++ b/docs/reference/es_compatible_api.md @@ -463,8 +463,6 @@ The following query types are supported. | `analyzer` | String | Analyzer meant to cut the query into terms. It is recommended to NOT use this parameter. | The actual field tokenizer. | - - ### `match_bool_prefix` [Elasticsearch reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html) @@ -560,11 +558,17 @@ Contrary to ES/Opensearch, in Quickwit, at most 50 terms will be considered when | Type | Description | | --------------- | ------------------------------------------------------------------------------------------- | | `most_fields` | (default) Finds documents which match any field and combines the `_score` from each field. | -| `phrase` | Runs a `match_phrase` query on each field and uses the `_score` from the best field . | -| `phrase_prefix` | Runs a `match_phrase_prefix` query on each field and uses the `_score` from the best field. | +| `phrase` | Runs a `match_phrase` query on each field. | +| `phrase_prefix` | Runs a `match_phrase_prefix` query on each field. | +| `bool_prefix` | Runs a `match_bool_prefix` query on each field. | +:::warning +In `phrase`, `phrase_prefix` and `bool_prefix` modes, Quickwit sums the score of the different fields instead of returns their max. +Also, while Quickwit does not support `best_fields` or `cross_fields`, it will not return an error when presented a `best_fields` or `cross_fields` type. For compatibilility reasons, Quickwit will silently accept these parameters and interpret them as a `most_fields` type. + +::: ### `term` diff --git a/quickwit/quickwit-query/src/elastic_query_dsl/range_query.rs b/quickwit/quickwit-query/src/elastic_query_dsl/range_query.rs index 5fc1d970f7..88b9df05c1 100644 --- a/quickwit/quickwit-query/src/elastic_query_dsl/range_query.rs +++ b/quickwit/quickwit-query/src/elastic_query_dsl/range_query.rs @@ -40,6 +40,7 @@ pub struct RangeQueryParams { lte: Option, #[serde(default)] boost: Option, + // Currently NO-OP (see #5109) #[serde(default)] format: Option, } diff --git a/quickwit/quickwit-serve/src/elasticsearch_api/model/search_body.rs b/quickwit/quickwit-serve/src/elasticsearch_api/model/search_body.rs index d6e0d8282c..abdd8ff189 100644 --- a/quickwit/quickwit-serve/src/elasticsearch_api/model/search_body.rs +++ b/quickwit/quickwit-serve/src/elasticsearch_api/model/search_body.rs @@ -66,28 +66,9 @@ struct FieldSortParams { pub date_format: Option, } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -pub struct SourceObject { - includes: Option>, - excludes: Option>, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -#[serde(untagged)] -pub enum Source { - Bool(bool), - String(String), - List(Vec), - Object(SourceObject), -} - #[derive(Debug, Default, Clone, Deserialize, PartialEq)] #[serde(deny_unknown_fields)] pub struct SearchBody { - #[serde(default)] - pub _source: Option, - #[serde(default)] - pub docvalue_fields: Option, #[serde(default)] pub from: Option, #[serde(default)] @@ -105,12 +86,18 @@ pub struct SearchBody { pub stored_fields: Option>, #[serde(default)] pub search_after: Vec, + + // Ignored values, only here for compatibility with opendashboard. + #[serde(default)] + pub _source: serde::de::IgnoredAny, + #[serde(default)] + pub docvalue_fields: serde::de::IgnoredAny, #[serde(default)] - pub script_fields: Option, + pub script_fields: serde::de::IgnoredAny, #[serde(default)] - pub highlight: Option, + pub highlight: serde::de::IgnoredAny, #[serde(default)] - pub version: Option, + pub version: serde::de::IgnoredAny, } struct FieldSortVecVisitor; @@ -289,10 +276,6 @@ mod tests { let search_body = serde_json::from_str::(json); let error_msg = search_body.unwrap_err().to_string(); assert!(error_msg.contains("unknown field `term`")); - assert!(error_msg.contains( - "expected one of `_source`, `docvalue_fields`, `from`, `size`, `query`, `sort`, \ - `aggs`, `track_total_hits`, `stored_fields`, `search_after`, `script_fields`, \ - `highlight`, `version`" - )); + assert!(error_msg.contains("expected one of ")); } }