Created
May 20, 2021 08:37
-
-
Save AviranAbady/53d1d8795163d4cd377b28e75564aee7 to your computer and use it in GitHub Desktop.
Elasticsearch reindex with inline script - casting of nested values
This file contains 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
POST _reindex | |
{ | |
"source": { | |
"index": "vehicles" | |
}, | |
"dest": { | |
"index": "vehicels-back" | |
}, | |
"script": { | |
"lang": "painless", | |
"inline": "def fuel_types = ctx._source.fuel_types; for(ft in fuel_types){if(ft.containsKey('tank_number')) {ft.tank_number = ft.tank_number.toString()}} ctx._source.fuel_types=fuel_types" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment