【发布时间】:2015-08-14 21:35:14
【问题描述】:
这是映射:
PUT books-index
{
"mappings": {
"books": {
"properties": {
"tags": {
"type": "nested",
"fields": {
"name": {
"type": "string"
},
"weight": {
"type": "float"
}
}
}
}
}
}
}
然后使用 field_value_factor 执行嵌套查询失败并出现错误
GET books-index/books/_search
{
"query": {
"nested": {
"path": "tags",
"score_mode": "sum",
"query": {
"function_score": {
"query": {
"match": {
"tags.name": "world"
}
},
"field_value_factor": {
"field": "weight"
}
}
}
}
}
}
错误:"nested: ElasticsearchException[Unable to find a field mapper for field [weight]]"
有趣的是,如果索引中有一本书带有标签 - 没有错误并且查询运行良好。
为什么会这样?索引中没有带有标签的书籍时,如何防止错误?
有什么想法吗?
谢谢!
附: github上也有一个问题:https://github.com/elastic/elasticsearch/issues/12871
【问题讨论】:
标签: elasticsearch