Elasticsearch:期望的字段名称,但获得了START_OBJECT

我一直在尝试运行以下查询,但是每次运行它时,都会收到以下错误:

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属性中。试试这个查询

{

"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 的全部内容, 来源链接: utcz.com/qa/412225.html

回到顶部