首页 > 解决方案 > ElasticSearch - [nested] 未能在路径下找到嵌套对象

问题描述

我的 ElasticSearch 查询有问题。我正在尝试在某个特定日期出发,并确认出发。

这是我的模板的一部分:

"mappings" : {
    "properties" : {
      "dates_depart" : {
        "type" : "nested",
        "properties": {
          "date_depart": {"type": "date"
          },
          "last_minute": {
            "type": "integer"
          },
          "depart_confirm": {
            "type": "integer"
          }
        }
      },
    }
}

这是我的查询:

"query": { "nested" : { "path" : "dates_depart", "query" : { "bool" : { "must" : [ { "match" : {"dates_depart.depart_confirme" : 1}}, { "range" : {"dates_departs.date_depart" : {"gte":"07\/11\/2018","lte":"15\/11\/2018","format":"dd\/MM\/yyyy"}} }]}}}}

但我的查询返回这个而不是 8 个结果:

"caused_by":{"type":"illegal_state_exception","reason":"[nested] nested object under path [dates_depart] is not of nested type"}}},"status":400}

我该如何解决?

标签: elasticsearch

解决方案


薄...没有考虑到模板的最后一个版本...我只是更正了谢谢。

不幸的是,现在我有一个新的错误。当然链接到我的索引

{"error":{"root_cause":[{"type":"json_e_o_f_exception","reason":"Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@67a98c0c; line: 1, column: 1])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@67a98c0c; line: 1, column: 533]"}],"type":"json_e_o_f_exception","reason":"Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@67a98c0c; line: 1, column: 1])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@67a98c0c; line: 1, column: 533]"},"status":500}

推荐阅读