I have a query using function_score and field_value_factor like this:
GET my_item_list/doc/_search
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"field_value_factor": {
"field": "sell_qty",
"factor": 1.2,
"missing": 1,
"modifier": "ln1p"
}
}
}
}
The query returns error like this:
"error": {
"root_cause": [
{
"type": "exception",
"reason": "function score query returned an invalid score: NaN for doc: 189398"
},
{
"type": "exception",
"reason": "function score query returned an invalid score: NaN for doc: 230635"
},
{
"type": "exception",
"reason": "function score query returned an invalid score: NaN for doc: 978211"
}
]
If I remove the "modifier": "ln1p" , the error disappears.
The sell_qty of the docs in id [189398,230635,978211] are all 0 but I set them to 1 if missing by setting:
"missing": 1 in the query.
Mapping of the index:
{
"my_item_list": {
"mappings": {
"doc": {
"properties": {
"act": {
"type": "nested",
"properties": {
"id": {
"type": "long"
},
"seq": {
"type": "integer"
}
}
},
"area": {
"type": "integer"
},
"ban": {
"type": "integer"
}
"name": {
"type": "text",
"fields": {
"en": {
"type": "text"
},
"in": {
"type": "text"
}
},
"analyzer": "standard"
},
"price": {
"type": "double"
},
"sell_qty": {
"type": "integer"
},
"status": {
"type": "byte"
},
"tag": {
"type": "text",
"fields": {
"en": {
"type": "text"
},
"in": {
"type": "text"
}
},
"analyzer": "standard"
},
"type": {
"type": "byte"
}
}
}
}
}
}
Could you please have a look? @dadoonet Thanks!