Hello,
I try to find a query for something looking easy for a human, but I can't create it with ES.
Let's imagine we have an index named words with a few data:
PUT words/_doc/1
{
"name": "elastic"
}
PUT words/_doc/2
{
"name": "delete"
}
PUT words/_doc/3
{
"name": "dagger"
}
PUT words/_doc/4
{
"name": "daily"
}
PUT words/_doc/5
{
"name": "dark"
}
PUT words/_doc/6
{
"name": "darth"
}
Is it possible to get every words starting by "d", but not starting by "da" except for those starting by "dar"? In my example, I must have the following list:
- delete
- dark
- darth
I tried something like that but it doesn't work:
GET /words/_search
{
"query": {
"bool": {
"must": [
{
"wildcard": {
"name": {
"value": "d*"
}
}
},
{
"wildcard": {
"name": {
"value": "dar*"
}
}
}
],
"must_not": [
{
"wildcard": {
"name": {
"value": "da*"
}
}
}
]
}
}
}
Thanks!