Dibyakanta
(Dibyakanta Sahoo)
September 25, 2019, 1:17pm
1
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
spinscale
(Alexander Reelsen)
September 25, 2019, 2:26pm
2
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
Dibyakanta
(Dibyakanta Sahoo)
September 25, 2019, 2:52pm
3
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
dadoonet
(David Pilato)
September 25, 2019, 5:40pm
4
You are using a match
query and not a wildcard
query. That's May be the reason.
Dibyakanta
(Dibyakanta Sahoo)
September 25, 2019, 6:28pm
5
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
dadoonet
(David Pilato)
September 25, 2019, 6:54pm
6
No.
In the first place you should never use a wildcard. It's slow.
You should prefer something like edge ngram based analyzers instead.
system
(system)
Closed
October 23, 2019, 7:18pm
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.