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 can I use elasticsearch zone awareness to improve my software development?
- How can I set up and use Elasticsearch on the Yandex Cloud platform?
- How do I use Elasticsearch with ZGC?
- How can I use Elasticsearch and ZFS together?
- How can I check the status of a yellow index in Elasticsearch?
- How can I use Elasticsearch to diagnose "yellow" issues?
- How can I use YouTube to learn about Elasticsearch?
- How can I integrate Elasticsearch into a Yii2 application?
- How do I use Yandex with Elasticsearch?
- How can I use Yandex Mirror to access Elasticsearch data?
See more codes...