elasticsearchHow do I perform an exact match search in Elasticsearch?
To perform an exact match search in Elasticsearch, you can use the term
query. This query will match documents that have exact terms specified in the query.
For example, if you have a field title
with value The quick brown fox
, the following query will match the document:
GET /_search
{
"query": {
"term": {
"title": {
"value": "The quick brown fox"
}
}
}
}
The output will be the document:
{
"_index": "my_index",
"_type": "_doc",
"_id": "1",
"_score": 1,
"_source": {
"title": "The quick brown fox"
}
}
The term
query consists of the following parts:
query
: The query type, in this caseterm
title
: The field to search invalue
: The exact value to search for
For more information, see the Elasticsearch documentation.
More of Elasticsearch
- How can I use elasticsearch zone awareness to improve my software development?
- How can I store and query zoned datetime values in Elasticsearch?
- How can I use Elasticsearch and Zabbix together for software development?
- How do I configure the Xms and Xmx settings for Elasticsearch?
- What are the system requirements for running Elasticsearch?
- How do I set up an Elasticsearch Yum repository?
- How can I set up and use Elasticsearch on the Yandex Cloud platform?
- How can I index XML data in Elasticsearch?
- How can I perform a case-insensitive wildcard search using Elasticsearch?
- How do I configure xpack.security.authc.realms in Elasticsearch?
See more codes...