Created
May 3, 2012 12:22
-
-
Save mente/2585300 to your computer and use it in GitHub Desktop.
Elasticsearch nested type update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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