Hello,
We have an ES cluster that stores daily indexes, like elb-2020.01.09 logs.
Apart from Index Life Cycle, is there are other ways to merge all elb-2020.01.* indexes into elb-2020.01 index and then delete all the elb-2020.01.* indexes?
I have the following painless script:
POST _reindex?requests_per_second=115&wait_for_completion=true
{
"source": {
"index": "elb-2020.01.*",
"size": 500
},
"dest": {
"index": "elb-2020.01"
},
"script": {
"lang": "painless",
"source": """
ctx._source.index = ctx._index;
def eventData = ctx._source["event.data"];
if (eventData != null) {
eventData.remove("realmDb.size");
eventData.remove("realmDb.format");
eventData.remove("realmDb.contents");
}
"""
}
}
This works but looking at https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-many-indices it is recommended to re-index them one-by-one.
Also I do get some errors, like:
{
"took": 8100,
"timed_out": false,
"total": 42798,
"updated": 0,
"created": 498,
"deleted": 0,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": 115,
"throttled_until_millis": 0,
"failures": [
{
"index": "elb-2020.01",
"type": "_doc",
"id": "hy3xvGgBJbHuicWHFn_C",
"cause": {
"type": "illegal_argument_exception",
"reason": "mapper [network.latency] cannot be changed from type [float] to [long]"
},
"status": 400
},
{
"index": "elb-2020.01",
"type": "_doc",
"id": "9S6ex2gBJbHuicWHadlX",
"cause": {
"type": "illegal_argument_exception",
"reason": "mapper [network.latency] cannot be changed from type [float] to [long]"
},
"status": 400
}
]
}
- Is this a simple way to do this?
- How do I deal with errors?
- For each daily index should I disable replica before merging into the monthly index?
- Anything else I would need to consider?
Any advice is much appreciated.