Elasticsearch-rails gem - completion helper
Hi I want to use completion helper using elasticsearch-rails gem.
I tried to follow the ruby ββclient documentation, but I don't have the same results when using the rails mail client and client.
Works with the postman:
{
"suggestions" : {
"text" : "s",
"completion" : {
"field" : "suggest"
}
}
}
Results:
{
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"suggestions": [
{
"text": "s",
"offset": 0,
"length": 3,
"options": [
{
"text": "superman",
"score": 1,
"payload": {
"id": 922,
"tumb_img": "/user/avatar/20/thumb_img.jpg"
}
}
]
}
]
}
But not with a ruby ββclient:
Article.__elasticsearch__.client.suggest(:index => '', :body => {
:suggestions => {
:text => "s",
:term => {
:field => 'suggest'
}
}
})
Results:
{
"_shards": {
"total": 11,
"successful": 11,
"failed": 0
},
"suggestions": [
{
"text": "s",
"offset": 0,
"length": 1,
"options": []
}
]
}
I also tried replacing the term with completion, but still doesn't work:
Article.__elasticsearch__.client.suggest(:index => '', :body => {
:suggestions => {
:text => "s",
:completion => {
:field => 'suggest'
}
}
})
+3
source to share