elasticsearchHow do I search by field using Elasticsearch?
To search by field using Elasticsearch, you need to use the term
query. The term
query is used to search for a specific value in a specific field. For example, the following query searches for documents with the value example
in the field title
:
GET /_search
{
"query": {
"term": {
"title": "example"
}
}
}
The output of this query will be a list of documents that contain the word example
in the title
field.
The term
query has the following parts:
query
: This is the root element of the query.term
: This is the type of query being used.title
: This is the field being searched.example
: This is the value being searched for.
For more information about the term
query, see the Elasticsearch documentation.
More of Elasticsearch
- How can I use YouTube to learn about Elasticsearch?
- How can I use elasticsearch zone awareness to improve my software development?
- How can I use Elasticsearch and ZFS together?
- How can I use Elasticsearch and Zabbix together for software development?
- How do I use Elasticsearch with ZGC?
- How can I use Elasticsearch and Zookeeper together to manage distributed applications?
- How can I use Elasticsearch to diagnose "yellow" issues?
- How do I set up an Elasticsearch Yum repository?
- How can I use the cat indices API in Elasticsearch?
- How can I set up and use Elasticsearch on the Yandex Cloud platform?
See more codes...