Elasticsearch Update By Query : 在现有索引 上重建
1 创建文档1
PUT book/_doc/1
{
"content":"SAP Material mangagement",
"keyword":"SAP"
}
2.更改索引
PUT book/_mapping
{
"properties":{
"content":{
"type":"text",
"fields":{
"english":{
"type":"text",
"analyzer":"english"
}
}
}
}
}
3 创建文档2
PUT book/_doc/2
{
"content":"Oracle database 12 management",
"keyword":"oracle"
}
4. 搜索文档2
POST book/_search
{
"query":{
"match": {
"content.english": "Oracle"
}
}
}
5. 搜索文档1 找不到
POST book/_search
{
"query":{
"match": {
"content.english": "SAP"
}
}
}
6. _update_by_query
POST book/_update_by_query
{}
7. 搜索文档1 可以找到
POST book/_search
{
"query":{
"match": {
"content.english": "SAP"
}
}
}