Hi
Below are the Details:-
GET /books1/_mapping
{
"books1": {
"mappings": {
"book": {
"properties": {
"author": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"language": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"publishYear": {
"type": "long"
},
"summary": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
},
"title": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
}
}
}
}
}
}
GET /books1/_settings
{
"books1": {
"settings": {
"index": {
"number_of_shards": "1",
"provided_name": "books1",
"creation_date": "1512494128646",
"analysis": {
"filter": {
"shingle": {
"max_shingle_size": "3",
"min_shingle_size": "2",
"type": "shingle"
}
},
"analyzer": {
"reverse": {
"filter": [
"standard",
"reverse"
],
"type": "custom",
"tokenizer": "standard"
},
"trigram": {
"filter": [
"standard",
"shingle"
],
"type": "custom",
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"uuid": "T2WwwsoIRhm-n88MpQ_tug",
"version": {
"created": "5060399"
}
}
}
}
}
Below is the search suggest query >>
POST /books1/_search
{
"suggest": {
"text" : "Jave programing",
"simple_phrase" : {
"phrase" : {
"field" : "summary.trigram",
"size" : 4,
"max_errors":3,
"direct_generator" : [ {
"field" : "summary.trigram",
"suggest_mode" : "always",
"min_word_length" : 1
} ],
"collate": {
"query": {
"source" : {
"match": {
"{{field_name}}" : "{{suggestion}}"
}
}
},
"params": {"field_name" : "summary"},
"prune": true
}
}
}
}
}
Below is the Result of the Query >>
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"simple_phrase": [
{
"text": "Jave programing",
"offset": 0,
"length": 15,
"options": [
{
"text": "Java programming",
"score": 0.040497053,
"collate_match": true
},
{
"text": "Jave programming",
"score": 0.00245566,
"collate_match": true
},
{
"text": "Java programing",
"score": 0.0019024129,
"collate_match": true
}
]
}
]
}
}
When We See the Query Result We See 3 results Java programming , Jave programming & Java programing... How Can We Rectify the Query to provide me result only and only if all the Words are correct and not Provide results like ** Jave programming & Java programing** where any one of the Words are Correct...
Pls Guide..