Hi!
I am going to make completion suggester in my search page, I used the display_name as the text, and I would like to insert id as the weight for sorting the suggester.
Here is my logstash filter
filter {
if [type] == "product"{
mutate {
add_field => { "product_suggest" => "%{display_name}" }
add_field => { "weight" => "%{id}" }
add_field => { "product_suggester" => "%{display_name}" }
remove_field => ["attribute_value_en", "attribute_value_sc"]
}
}
if [type] == "merchant"{
mutate {
add_field => { "merchant_suggest" => "%{merchant_name}" }
add_field => { "weight" => "%{id}" }
add_field => { "merchant_suggester" => "%{merchant_name}" }
}
}
}
Here is the example I try to write
PUT music/song/1?refresh
{
"suggest" : [
{
"input": "Nevermind",
"weight" : 10
},
{
"input": "Nirvana",
"weight" : 3
}
]
}