本文介绍了Elasticsearch:期望的字段名称,但获得了START_OBJECT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试运行以下查询,但是每次运行该查询都会收到以下错误:
I've been trying to run the following query, but every time I run it I receive the following error:
nested: ElasticsearchParseException[Expected field name but got START_OBJECT \"field_value_factor\"]; }]","status":400
这是查询:
{
"query": {
"function_score": {
"query": {
"bool": {
"should": [{
"match": {
"thread_name": "parenting"
}
}, {
"nested": {
"path": "messages",
"query": {
"bool": {
"should": [{
"match": {
"messages.message_text": "parenting"
}
}]
}
},
"inner_hits": {}
}
}]
}
}
},
"field_value_factor": {
"field": "thread_view"
}
}
}
推荐答案
您的field_value_factor
函数放错了位置.它应嵌套在functions
属性.尝试使用此查询
Your field_value_factor
function is misplaced. it should be nested within the functions
property. Try this query instead
{
"query": {
"function_score": {
"functions": [
{
"field_value_factor": {
"field": "thread_view"
}
}
],
"query": {
"bool": {
"should": [
{
"match": {
"thread_name": "parenting"
}
},
{
"nested": {
"path": "messages",
"query": {
"bool": {
"should": [
{
"match": {
"messages.message_text": "parenting"
}
}
]
}
},
"inner_hits": {}
}
}
]
}
}
}
}
}
这篇关于Elasticsearch:期望的字段名称,但获得了START_OBJECT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!