﻿---
title: Vector queries
description: Vector queries are specialized queries that work on vector fields to efficiently perform semantic search. The following queries have been deprecated and...
url: https://www.elastic.co/elastic/docs-builder/docs/2642/reference/query-languages/query-dsl/vector-queries
products:
  - Elasticsearch
---

# Vector queries
Vector queries are specialized queries that work on vector fields to efficiently perform [semantic search](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2642/solutions/search/semantic-search).
<definitions>
  <definition term="knn query">
    A query that finds the *k* nearest vectors to a query vector for [`dense_vector`](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/elasticsearch/mapping-reference/dense-vector) fields, as measured by a similarity metric.
  </definition>
  <definition term="sparse_vector query">
    A query used to search [`sparse_vector`](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/elasticsearch/mapping-reference/sparse-vector) field types.
  </definition>
  <definition term="semantic query">
    A query that allows you to perform semantic search on [`semantic_text`](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/elasticsearch/mapping-reference/semantic-text) fields.
  </definition>
</definitions>


## Deprecated vector queries

The following queries have been deprecated and will be removed in the near future. Use the [`sparse_vector` query](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/query-languages/query-dsl/query-dsl-sparse-vector-query) query instead.
<definitions>
  <definition term="text_expansion query">
    A query that allows you to perform sparse vector search on [`sparse_vector`](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/elasticsearch/mapping-reference/sparse-vector) or [`rank_features`](https://www.elastic.co/elastic/docs-builder/docs/2642/reference/elasticsearch/mapping-reference/rank-features) fields.
  </definition>
  <definition term="weighted_tokens query">
    Allows to perform text expansion queries optimizing for performance.
  </definition>
</definitions>