Skip to content

Instantly share code, notes, and snippets.

@gigkokman
Created August 31, 2018 03:30
Show Gist options
  • Save gigkokman/3d33eec724b52cd151419ef19476d390 to your computer and use it in GitHub Desktop.
Save gigkokman/3d33eec724b52cd151419ef19476d390 to your computer and use it in GitHub Desktop.
Reindexing Elasticsearch for daily indices
POST _reindex
{
"source": {
"index":"test_fields-*",
"_source": {
"includes": ["field1", "field2"]
}
},
"dest": {
"index": "test_fields"
},
"script": {
"lang": "painless",
"source": "ctx._index = 'test_fields-' + (ctx._index.substring('test_fields-'.length(), ctx._index.length())) + '-1'"
}
}
POST test_fields-2018.08.31/doc
{
"field1": "field 1",
"field2": "field 2",
"field3": "field 3",
"field4": "field 4"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment