Skip to content

Instantly share code, notes, and snippets.

@mente
Created May 3, 2012
Embed
What would you like to do?
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