ES _delete_by_query

更新,如果字段值类型错误,可以用下面语句修改

int类型,但是字段值是字符串,转成int/long类型

POST your_index/_update_by_query { "query": { "term": { "your_field": "33" } }, "script": { "lang": "painless", "source": "if (ctx._source.your_field instanceof String) { ctx._source.your_field = Integer.parseInt(ctx._source.your_field); }" } }

float类型,但是字段值是字符串,转成float/double类型

POST your_index/_update_by_query { "query": { "term": { "your_float_field": "33" } }, "script": { "lang": "painless", "source": "if (ctx._source.your_float_field instanceof String) { ctx._source.your_float_field = Double.parseDouble(ctx._source.your_float_field); }" } }

----------------

POST myindex/mytype/_delete_by_query
{
"query": {
"bool": {
"must_not": [
{
"wildcard": {
"QRINFO": {
"value": "*|*"
}
}
}
]
}
}
}

posted on 2018-03-07 09:02  zhangfeitaimengle  阅读(389)  评论(0)    收藏  举报

导航