Skip to content

Commit

Permalink
Group vector queries into new section (#110722)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest authored Jul 11, 2024
1 parent 19cc601 commit f29b92c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 29 deletions.
6 changes: 2 additions & 4 deletions docs/reference/query-dsl.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ include::query-dsl/match-all-query.asciidoc[]

include::query-dsl/span-queries.asciidoc[]

include::query-dsl/vector-queries.asciidoc[]

include::query-dsl/special-queries.asciidoc[]

include::query-dsl/term-level-queries.asciidoc[]

include::query-dsl/text-expansion-query.asciidoc[]

include::query-dsl/sparse-vector-query.asciidoc[]

include::query-dsl/minimum-should-match.asciidoc[]

include::query-dsl/multi-term-rewrite.asciidoc[]
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/query-dsl/sparse-vector-query.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[query-dsl-sparse-vector-query]]
== Sparse vector query
=== Sparse vector query

++++
<titleabbrev>Sparse vector</titleabbrev>
Expand All @@ -19,7 +19,7 @@ For example, a stored vector `{"feature_0": 0.12, "feature_1": 1.2, "feature_2":

[discrete]
[[sparse-vector-query-ex-request]]
=== Example request using an {nlp} model
==== Example request using an {nlp} model

[source,console]
----
Expand All @@ -37,7 +37,7 @@ GET _search
// TEST[skip: Requires inference]

[discrete]
=== Example request using precomputed vectors
==== Example request using precomputed vectors

[source,console]
----
Expand All @@ -55,7 +55,7 @@ GET _search

[discrete]
[[sparse-vector-field-params]]
=== Top level parameters for `sparse_vector`
==== Top level parameters for `sparse_vector`

`field`::
(Required, string) The name of the field that contains the token-weight pairs to be searched against.
Expand Down Expand Up @@ -120,7 +120,7 @@ NOTE: The default values for `tokens_freq_ratio_threshold` and `tokens_weight_th

[discrete]
[[sparse-vector-query-example]]
=== Example ELSER query
==== Example ELSER query

The following is an example of the `sparse_vector` query that references the ELSER model to perform semantic search.
For a more detailed description of how to perform semantic search by using ELSER and the `sparse_vector` query, refer to <<semantic-search-elser,this tutorial>>.
Expand Down Expand Up @@ -241,7 +241,7 @@ GET my-index/_search

[discrete]
[[sparse-vector-query-with-pruning-config-and-rescore-example]]
=== Example ELSER query with pruning configuration and rescore
==== Example ELSER query with pruning configuration and rescore

The following is an extension to the above example that adds a preview:[] pruning configuration to the `sparse_vector` query.
The pruning configuration identifies non-significant tokens to prune from the query in order to improve query performance.
Expand Down
13 changes: 0 additions & 13 deletions docs/reference/query-dsl/special-queries.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ or collection of documents.
This query finds queries that are stored as documents that match with
the specified document.

<<query-dsl-knn-query,`knn` query>>::
A query that finds the _k_ nearest vectors to a query
vector, as measured by a similarity metric.

<<query-dsl-rank-feature-query,`rank_feature` query>>::
A query that computes scores based on the values of numeric features and is
able to efficiently skip non-competitive hits.
Expand All @@ -32,9 +28,6 @@ This query allows a script to act as a filter. Also see the
<<query-dsl-script-score-query,`script_score` query>>::
A query that allows to modify the score of a sub-query with a script.

<<query-dsl-semantic-query,`semantic` query>>::
A query that allows you to perform semantic search.

<<query-dsl-wrapper-query,`wrapper` query>>::
A query that accepts other queries as json or yaml string.

Expand All @@ -50,20 +43,14 @@ include::mlt-query.asciidoc[]

include::percolate-query.asciidoc[]

include::knn-query.asciidoc[]

include::rank-feature-query.asciidoc[]

include::script-query.asciidoc[]

include::script-score-query.asciidoc[]

include::semantic-query.asciidoc[]

include::wrapper-query.asciidoc[]

include::pinned-query.asciidoc[]

include::rule-query.asciidoc[]

include::weighted-tokens-query.asciidoc[]
12 changes: 6 additions & 6 deletions docs/reference/query-dsl/text-expansion-query.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[query-dsl-text-expansion-query]]
== Text expansion query
=== Text expansion query

++++
<titleabbrev>Text expansion</titleabbrev>
Expand All @@ -12,7 +12,7 @@ The text expansion query uses a {nlp} model to convert the query text into a lis

[discrete]
[[text-expansion-query-ex-request]]
=== Example request
==== Example request

[source,console]
----
Expand All @@ -32,14 +32,14 @@ GET _search

[discrete]
[[text-expansion-query-params]]
=== Top level parameters for `text_expansion`
==== Top level parameters for `text_expansion`

`<sparse_vector_field>`:::
(Required, object) The name of the field that contains the token-weight pairs the NLP model created based on the input text.

[discrete]
[[text-expansion-rank-feature-field-params]]
=== Top level parameters for `<sparse_vector_field>`
==== Top level parameters for `<sparse_vector_field>`

`model_id`::::
(Required, string) The ID of the model to use to convert the query text into token-weight pairs.
Expand Down Expand Up @@ -84,7 +84,7 @@ NOTE: The default values for `tokens_freq_ratio_threshold` and `tokens_weight_th

[discrete]
[[text-expansion-query-example]]
=== Example ELSER query
==== Example ELSER query

The following is an example of the `text_expansion` query that references the ELSER model to perform semantic search.
For a more detailed description of how to perform semantic search by using ELSER and the `text_expansion` query, refer to <<semantic-search-elser,this tutorial>>.
Expand Down Expand Up @@ -208,7 +208,7 @@ GET my-index/_search

[discrete]
[[text-expansion-query-with-pruning-config-and-rescore-example]]
=== Example ELSER query with pruning configuration and rescore
==== Example ELSER query with pruning configuration and rescore

The following is an extension to the above example that adds a preview:[] pruning configuration to the `text_expansion` query.
The pruning configuration identifies non-significant tokens to prune from the query in order to improve query performance.
Expand Down
37 changes: 37 additions & 0 deletions docs/reference/query-dsl/vector-queries.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[vector-queries]]
== Vector queries

Vector queries are specialized queries that work on vector fields to efficiently perform <<semantic-search,semantic search>>.

<<query-dsl-knn-query,`knn` query>>::
A query that finds the _k_ nearest vectors to a query vector for <<dense-vector,`dense_vector`>> fields, as measured by a similarity metric.

<<query-dsl-sparse-vector-query,`sparse_vector` query>>::
A query used to search <<sparse-vector,`sparse_vector`>> field types.

<<query-dsl-semantic-query,`semantic` query>>::
A query that allows you to perform semantic search on <<semantic-text,`semantic_text`>> fields.

[discrete]
=== Deprecated vector queries

The following queries have been deprecated and will be removed in the near future.
Use the <<query-dsl-sparse-vector-query,`sparse_vector` query>> query instead.

<<query-dsl-text-expansion-query,`text_expansion` query>>::
A query that allows you to perform sparse vector search on <<sparse-vector,`sparse_vector`>> or <<rank-features,`rank_features`>> fields.

<<query-dsl-weighted-tokens-query,`weighted_tokens` query>>::
Allows to perform text expansion queries optimizing for performance.

include::knn-query.asciidoc[]

include::sparse-vector-query.asciidoc[]

include::semantic-query.asciidoc[]

include::text-expansion-query.asciidoc[]

include::weighted-tokens-query.asciidoc[]


0 comments on commit f29b92c

Please sign in to comment.