2014-09-03 50 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" } 
      } 
     } 
     } 
    } 
相关问题