Skip to content

Instantly share code, notes, and snippets.

@mente
Created May 3, 2012 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mente/2585300 to your computer and use it in GitHub Desktop.
Save mente/2585300 to your computer and use it in GitHub Desktop.
Elasticsearch nested type update
Works:
{
"script": "ctx._source.comments = comments",
"params": {
"comments": [{
"id": 123,
"body": "boom"
}]
}
}
Does not work for nested type:
{
"script": "ctx._source.comments += comment",
"params": {
"comment": {
"id": 123,
"body": "boom"
}
}
}
Throws MapperParsingException[object mapping for [test] tried to parse as object, but got EOF, has a concrete value been provided to it?]
Mapping:
{
"test" : {
"properties" : {
"author" : {
"type" : "string"
},
"comments" : {
"type" : "nested",
"properties" : {
"body" : {
"type" : "string"
},
"id" : {
"type" : "long"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment