2014-02-18 187 views
0

當我想從我的彈性搜索中獲取數據時,我得到一個解析異常。我的文件看起來像這樣Elasticsearch嵌套查詢parseException

{ 
     "_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的所有文件。但是我的查詢已經給我一個parseexception(所有的碎片失敗的階段:[查詢]),即使沒有說poDValue應該是NO。

回答

0

我想你誤解了嵌套對象的概念。您只是使用對象內容,而不是嵌套對象。檢查這一個:

POST /_search 
{ 
    "query": { 
     "term": { 
      "employer.titel": { 
       "value": "Dit is mijn titel" 
      } 
     } 
    } 
} 
+0

我以爲相同,但也與查詢鍵它給我同樣的錯誤 – user2248905