Wildcard * is not working for my index

Hi,

I have created an index with the following mapping:

PUT abc
{
"mappings": {
"type" : {
"properties": {
"title" : {
"type": "text",
"analyzer": "standard"
}
}
}
}
}

After this I added documents to it like:
PUT abc/type/2
{
"title" : "douglas adams"
}

So now when I am searching through wildcard , I am not getting any result. My query is
GET abc/_search
{
"query": {
"match": {
"title": "doug
"
}
}
}

So, ideally the result should come. But I am not getting any result. Please help me and correct me where I am wrong.

Thank You.

Regards,
Dibyakanta

So douglas adams will be split into two tokens, douglas and adams. Searching for doug will not yield any result.

There is a variety of ways to solve this

A good start on the topic of partial matching is the definitive guide, despite being a little outdated it still explains the different concepts very well. See https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-matching.html

Hi,

I wrote a wrong query by mistake.

My updated query is :

GET abc/_search
{
"query": {
"match": {
"title": "doug* "
}
}
}

I am trying to search using wild card *. The term which I am searching is doug*. But I am not getting any results.

Thank you.

Regards,
Dibyakanta

You are using a match query and not a wildcard query. That's May be the reason.

Hi,

@dadoonet, Thank You for your reply. I tried with wildcard and its working fine.

So, my question is , Is it not possible to search terms having wild card character (for e.g doug*) using match query.

Thank You.

Regards,
Dibyakanta

No.

In the first place you should never use a wildcard. It's slow.
You should prefer something like edge ngram based analyzers instead.

OK.

Thanku very much.