elastic-search suggester
Use kibana sense to create your mappings
Note:Dont forget to add suggest: filed with your mapping as shown below
eg:
Then to use the suggester
you need to do like shown below
On the head object like in this case "music" is parent object which has "songs"
you need to add suggester and point to suggest field
that's it you will get your suggester working
NOTE: this search might also show you deleted documents .
if you dont want this to happen then you need to index your page every time you add or update the data
As shown below :
$ curl -XPOST 'http://localhost:9200/_optimize?only_expunge_deletes=true'
for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
Use kibana sense to create your mappings
Note:Dont forget to add suggest: filed with your mapping as shown below
eg:
{
"mappings": {
"User": {
"properties": {
"fName": {
"type": "string",
"index": "not_analyzed"
},
"suggest" : {
"input": [ "Nevermind", "Nirvana" ],//on these input you will get the suggestions
"output": "Nirvana - Nevermind",//this will be your auto complete return result
"payload" : { "artistId" : 2321 },//you can include the payload too with return resule
"weight" : 34 //preference
}
}
}
}
Then to use the suggester
you need to do like shown below
On the head object like in this case "music" is parent object which has "songs"
you need to add suggester and point to suggest field
curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{ "song-suggest" : { "text" : "n", "completion" : { "field" : "suggest" } } }'
To add fuzzy suggester curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{ "song-suggest" : { "text" : "n", "completion" : { "field" : "suggest", "fuzzy" : { "fuzziness" : 2 } } } }'
that's it you will get your suggester working
NOTE: this search might also show you deleted documents .
if you dont want this to happen then you need to index your page every time you add or update the data
As shown below :
$ curl -XPOST 'http://localhost:9200/_optimize?only_expunge_deletes=true'
for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
If you're looking to lose weight then you have to start following this totally brand new custom keto plan.
ReplyDeleteTo create this keto diet, licenced nutritionists, fitness trainers, and top chefs have united to produce keto meal plans that are effective, convenient, cost-efficient, and delicious.
From their first launch in 2019, thousands of clients have already remodeled their figure and health with the benefits a good keto plan can provide.
Speaking of benefits: in this link, you'll discover 8 scientifically-certified ones provided by the keto plan.