好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

6.X 如何给文档加权?旧的资料全部不好使

Elasticsearch | 作者 flyfeifei66 | 发布于2018年02月12日 | 阅读数:3413

{
"title":{"_value":"湖北移动","_boost":"10"},
"content":"我的移动",
"count":"105",
"channel":"bbc",
"color":"red",
"price":"85",
"boost":"3",
"_boost":"3"
}

这是我根据旧的资料试的,最后两行给文档加权,没有任何效果,把boost _boost都当成了普通字段。后来又看到些资料说es从4.0开始不支持文档提升了,用加权字段的方法模拟给文档加权,我就改了一下,如第一行,因为字段是text文本,按照加权的写法是个object,就直接报错了,文档put不进去了,有用新版本加过权的吗?怎么感觉6.X各种不好使啊。比起2.X改动的如此大。

报错如下:
{

"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse [title]"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse [title]",
"caused_by": {
"type": "illegal_state_exception",
"reason": "Can't get text on a START_OBJECT at 1:10"
}
},
"status": 400

}
已邀请:

locatelli

赞同来自:

5.x开始不支持:[url=https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html]https://www.elastic.co/guide/e ... .html​[/url] 
 
 
 


Deprecated in 5.0.0.

index time boost is deprecated. Instead, the field mapping boost is applied at query time. For indices created before 5.0.0 the boost will still be applied at index time.

要回复问题请先登录注册