elasticsearchHow can I perform a case-insensitive wildcard search using Elasticsearch?
A wildcard search in Elasticsearch using a case-insensitive query is possible by using the lowercase_expanded_terms
parameter.
Example code
GET /my_index/_search
{
"query": {
"wildcard": {
"my_field": {
"value": "*test*",
"lowercase_expanded_terms": false
}
}
}
}
This query will return all documents that contain the term test
in the my_field
field, regardless of the case.
The lowercase_expanded_terms
parameter is set to false
by default, so it is not necessary to set it explicitly.
Code explanation
GET /my_index/_search
- the endpoint used to send the query to Elasticsearch"query": { "wildcard": { "my_field": { "value": "*test*"
- thewildcard
query used to perform the search, withmy_field
as the field to search in and*test*
as the value to search for"lowercase_expanded_terms": false
- the parameter used to make the search case-insensitive
Helpful links
More of Elasticsearch
- How do I use an elasticsearch query builder?
- How can I use Elasticsearch and ZFS together?
- How do I set up an Elasticsearch Yum repository?
- How can I configure an Elasticsearch Prometheus exporter?
- How can I use YouTube to learn about Elasticsearch?
- How do I use Elasticsearch with Python?
- How can I get started with using Elasticsearch OSS?
- How can I use elasticsearch zone awareness to improve my software development?
- How can I use Elasticsearch and Zookeeper together to manage distributed applications?
- How can I use Elasticsearch to diagnose "yellow" issues?
See more codes...