0

当我想从弹性搜索中获取数据时出现解析异常。我的文档看起来像这样

{
        "_index": "some name",
        "_type": "row",
        "_id": "665",
        "_score": 6.3700795,
        "_source": {
           "dateOfClaim": 1215986400000,
           "employer": {
              "username": null,
              "password": null,
              "name": "customer",
              "customerNumber": "some number",
              "dosierNumbers": null
           },
           "recipient": {
              "username": null,
              "password": null,
              "name": "some name",
              "taxNumber": "some number"
           },
           "claim": 402401,
           "dosierNumber": "",
           "worthWayTaxes": "",
           "good": {
              "brutoWeight": 25,
              "nettoWeight": 25050,
              "coll": 25000,
              "taxWorth": "58830.67",
              "eori": ""
           },
           "poDValues": "YES",
           "correctedTaxNumber": null,
           "note": null
        }
     },

我的查询看起来像这样

POST /customs/_search
{
    "nested" : {
        "path" : "employer",
        "score_mode" : "none",
        "query" : {
            "match": {
               "employer.name" : "customer"
            }
        }
    }
}

我想获取 poDValue 为 NO 的特定雇主的所有文件。但是我的查询已经给了我一个解析异常(所有分片在阶段失败:[查询]),即使没有说 poDValue 应该是 NO。

4

1 回答 1

0

我认为您误解了嵌套对象的概念。您只是使用对象内容,而不是嵌套对象。检查这个:

POST /_search
{
    "query": {
        "term": {
           "employer.titel": {
              "value": "Dit is mijn titel"
           }
        }
    }
}
于 2014-02-18T12:17:27.117 回答