Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "mappings": {
- "mytype": {
- "properties": {
- "Myfield1": {
- "type": "nested",
- "properties": {
- "field1": {
- "type": "string"
- },
- "field2": {
- "type": "long"
- }
- }
- },
- "Title": {
- "type": "string"
- }
- }
- }
- }
- {
- "query": {
- "match": {
- "Title": "elasticsearch"
- }
- },
- "script": "ctx._source.Myfield1 = [{'nestfield1':'foo blabla...','nestfield2':100},{'nestfield1':'abc...','nestfield2':200}]"
- }
- "query" : {
- "match_all" : {}
- },
- "script" : "ctx._source.Myfield1 = Myfield1;",
- "params": {
- "Myfield1": {
- "nestfield1": "foo blabla..."
- }
- }
- "query" : {
- "match_all" : {}
- },
- "script" : "ctx._source.Myfield1 = Myfield1; ctx._source.Myfield1.nestfield1 = ctx._source.Myfield1Nestfield1; ctx._source.Myfield1.nestfield2 = ctx._source.Myfield1Nestfield2;",
- "params": {
- "Myfield1": {
- "nestfield1": "init_data"
- }
- }
- POST indexname/type/_update_by_query
- {
- "query": {
- "match": {
- "Title": "elasticsearch"
- }
- },
- "script": {
- "source": "ctx._source.Myfield1= params.mifieldAsParam",
- "params": {
- "mifieldAsParam": [
- {
- "nestfield1": "foo blabla...",
- "nestfield2": 100
- },
- {
- "nestfield1": "abc...",
- "nestfield2": 200
- }
- ]
- },
- "lang": "painless"
- }
- }
Add Comment
Please, Sign In to add comment