Thanks for reading it. I am trying to implement the keyword search in my rails application. I wanted to categorize the results one after the other based on one field value. SO I tried to apply weight using function_score. The weight is working fine and I could able to categorize But the multi match query inside the function_score is not returning all results when I call from rails application But It is returning accurate results when I call it from sense.
Here is My sample Query:
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "reading",
"fields": ["field_1","field_2","field_3"]
}
},
"boost_mode": "sum",
"functions": [
{
"filter": {
"term": {
"field_4": "a"
}
},
"weight": 500
},{
"filter": {
"term": {
"field_4": "b"
}
},
"weight": 400
},
{
"filter": {
"term": {
"field_4": "c"
}
},
"weight": 200
},
{
"filter": {
"term": {
"field_4": "d"
}
},
"weight": 100
},
{
"filter": {
"term": {
"field_4": "e"
}
},
"weight": 50
}
]
}
}
My result from sense: "hits": { "total": 397,
My result from rails3 application is giving 35 records.
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire