Hello
I created an index using the below code
PUT test
{
"settings": {
"index": {
"number_of_shards": 1,
"analysis": {
"analyzer": {
"trigram": {
"type": "custom",
"tokenizer": "standard",
"filter": ["standard", "shingle"]
},
"reverse": {
"type": "custom",
"tokenizer": "standard",
"filter": ["standard", "reverse"]
}
},
"filter": {
"shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
}
}
}
}
},
"mappings": {
"test": {
"properties": {
"title": {
"type": "text",
"fields": {
"trigram": {
"type": "text",
"analyzer": "trigram"
},
"reverse": {
"type": "text",
"analyzer": "reverse"
}
}
}
}
}
}
}
then i placed some data into that by the below code.
POST test/test?refresh=true
{"title": "noble warriors"}
POST test/test?refresh=true
{"title": "nobel prize"}
POST test/test?refresh=true
{"title": "nobele prize"}
and then tried the phrase suggestor by the below code :-
POST test/_search
{
"suggest": {
"text" : "nobl prize",
"simple_phrase" : {
"phrase" : {
"field" : "title.trigram",
"size" : 1,
"direct_generator" : [ {
"field" : "title.trigram",
"suggest_mode" : "always"
}, {
"field" : "title.reverse",
"suggest_mode" : "always",
"pre_filter" : "reverse",
"post_filter" : "reverse"
} ]
}
}
}
}
received the below result :-
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"simple_phrase": [
{
"text": "nobl prize",
"offset": 0,
"length": 10,
"options": [
{
"text": "nobel prize",
"score": 0.52381706
}
]
}
]
}
}
The problem with search is as below :-
-
The Expected output should be 2 option as below
{"title": "nobel prize"}
{"title": "nobele prize"}
as they both are present in the index .. -
when i try search nobal preze or nobl preze then i receive the result after correction of only one word..that preze into prize also when i search for nobal prize or nobl prize then i received nobl or nobal into nobel
pls guide..