es painless刷数据,将list刷为item
POST your_index/_update_by_query
{
"script": {
"lang": "painless",
"source": """
if (ctx._source.column instanceof List) {
ctx._source.column = ctx._source.column[0];
}
"""
},
"query": {
"exists": {
"field": "column"
}
}
}
es painless刷数据,将item刷为list
POST your_index/_update_by_query
{
"script": {
"lang": "painless",
"source": """
if (ctx._source.containsKey('column') && !(ctx._source.column instanceof List)) {
ctx._source.column = [ctx._source.column];
}
"""
},
"query": {
"exists": {
"field": "column"
}
}
}