2016-09-14 3 views
0

는 내가이 작업을 수행 할 수있는 방법을 입력 배열의 내 문서에서 '태그'라는 이름의 필드를했다 :ElasticSearch에서 스크립트를 사용하여 배열 형식의 필드를 업데이트하는 방법은 무엇입니까?

If a tag is in the field 'tags', then do nothing; else add the tag to 'tags'. 

내가 끝내 아무 생각이 없다,하지만이 시도했습니다 것을 용서 :

curl -XPOST localhost:9200/file/company/13862/_update?pretty -d '{script:{inline:"ctx._source.tags.contains(tag) ? ctx.op=\"noop\" : ctx._source.tags += tag", params: {tag: 3}}}' 

그러나 오류 밝혀 :

"Failed to compile inline script [ctx._source.tags.contains(tag) ? ctx.op=\"noop\" : ctx._source.tags += tag] using lang [groovy]"

답변

0

시도를 10
+0

고맙습니다. 시도해 보겠습니다. –

관련 문제