2014-09-03 37 views
0

對於我給定的ElasticSearch文檔,我可以更新名爲「ResourcePort」的特定字段的值。但是當我嘗試更新字段名稱「Domain.threat」時,更新失敗並顯示「Illegal Argument Exception」。是否因爲字段名稱中有一個「點」?我在這個意義上的插件運行的代碼是ElasticSearch更新由於標記名稱而失敗?

POST /foo/bar/12/_update 
{"script":"ctx._source.Domain.threat='bad'"} 

但這部作品

POST /foo/bar/12/_update 
{"script":"ctx._source.ResourcePort='bad'"} 

編輯: 我的ES版本是1.1.0 的Domain.threat字段是 「Domain.threat」:{」鍵入「:」字符串「}

+0

實際對象的外觀如何?和哪個版本的Elasticsearch? – pickypg 2014-09-04 00:48:13

+0

我更新了原始的轉貼,希望能夠回答你的問題。謝謝! – cybergoof 2014-09-05 14:25:34

+0

抱歉延遲。什麼是實際的'IllegalArgumentException'?我在1.1.0上沒有任何問題。我猜測正在更新的對象實際上並沒有一個'Domain'對象來保存'威脅',但我可能會誤解。 – pickypg 2014-09-11 04:51:32

回答

1

我認爲問題在於您沒有將域映射爲嵌套字段。 確保您已將域名設置爲 - :

{ 
     "properties": { 
     "Domain": { 
      "type": "nested", 
      "properties": { 
      "threat": { "type": "string" } 
      } 
     } 
     } 
    } 
相關問題