[[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[]


