代码之家  ›  专栏  ›  技术社区  ›  TheNovice

Elasticsearch查询使用更像\u的\u此字段表示无法解析搜索源。需要字段名,但出现[START\u OBJECT]错误

  •  1
  • TheNovice  · 技术社区  · 5 年前

    我们正在使用ElasticSearch2.4.5。有一个可以生成相当复杂查询的应用程序。我想添加一个 more_like_this

    {
      "query": {
        "more_like_this": {
          "fields": [
            "title"
          ],
          "ids": [
            1234
          ],
          "min_term_freq": 1,
          "max_query_terms": 25
        },
        "function_score": {
          "query": {
            "bool": {
              "must": [
                {
                  "query_string": {
                    "default_operator": "AND",
                    "fields": [
                      "title",
                      "author"
                    ],
                    "query": "((title:(\"Tale of Two Cities\"^2)))",
                    "lenient": true
                  }
                }
              ],
              "filter": {
                "bool": {
                  "must": [
                    {
                      "bool": {
                        "should": [
                          {
                            "geo_distance": {
                              "distance": "50mi",
                              "location": {
                                "lat": 49.32,
                                "lon": -45.67
                              },
                              "distance_type": "plane",
                              "_cache": true
                            }
                          }
                        ]
                      }
                    },
                    {
                      "term": {
                        "merged": 0
                      }
                    },
                    {
                      "bool": {
                        "must_not": {
                          "exists": {
                            "field": "title_type"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "functions": [
            {
              "field_value_factor": {
                "field": "quality_score",
                "factor": 1,
                "missing": 0
              }
            }
          ]
        }
      },
      "filter": {
        "bool": {
          "must": []
        }
      },
      "sort": "_score",
      "size": 20,
      "from": 0
    }
    

    我得到一个 failed to parse search source. expected field name but got [START_OBJECT] 更像这样

    0 回复  |  直到 5 年前