curl localhost:9200/tweet/posts/_search -d '{
"query": {
"and": [
{
"wildcard": {
"_all": "*pet*"
}
},
{
"wildcard": {
"_all": "*rom*"
}
}
]
}
}'
This gives me a parse exception. I want to run a MySQL like(%test%)
type query with an AND condition. Is there any other good way to do in elasticsearch.
A wildcard operator is a placeholder that matches one or more characters. For example, the * wildcard operator matches zero or more characters. You can combine wildcard operators with other characters to create a wildcard pattern.
To locate a specific item when you can't remember exactly how it is spelled, try using a wildcard character in a query. Wildcards are special characters that can stand in for unknown characters in a text value and are handy for locating multiple items with similar, but not identical data.
There are two wildcard expressions you can use in Kibana – asterisk (*) and question mark (?). * matches any character sequence (including the empty one) and ? matches single characters. Since these queries are performed across a large number of terms, they can be extremely slow.
Maybe something like this?
{
"query": {
"bool": {
"must": [
{
"wildcard": {
"_all": {
"value": "*pet*"
}
}
},
{
"wildcard": {
"_all": {
"value": "*rom*"
}
}
}
]
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With