es 字段 replace

Husk Mit Navn232 丹麦 艺术家 哥本哈根 幽默 纸上 纸上艺术 立体插画 插花艺术 三维 立体感 创意22 脑洞大开 纸艺创意22


type/type/1/_update
{
  "script" : "ctx._source.tagName=ctx._source.tagName.replace(\" 创意22 \",\" 创意55 \")"
}

{
    "script" : "ctx._source.tagName = ctx._source.tagName.contains(tag) ? ctx._source.tagName.replace(tag,tag3):ctx._source.tagName.replace(tag2,tag3)",
    "params" : {
        "tag" : " 创意22 ","tag2":"创意22","tag3":" 创意55 "
    }
}

{
    "script" : "ctx._source.tagName = ctx._source.tagName.contains(tag) ? ctx._source.tagName.replace(tag,tag3):ctx._source.tagName.replace(tag2,tag3)",
    "script" : "ctx._source.tagName = ctx._source.tagName.contains(tag4) ? ctx._source.tagName.replace(tag4,tag5):ctx._source.tagName.replace(tag4,tag3)",
    "params" : {
        "tag" : " 创意22 ","tag2":"创意22","tag3":" 创意55 ","tag4":" 纸上 ","tag5":"纸上55"
    }
}

{
    "script" : "ctx._source.tagName = ctx._source.tagName.contains(tag) ? ctx._source.tagName.replace(tag,tag3):ctx._source.tagName.replace(tag2,tag3)",
    "script" : "ctx._source.tagName2 = ctx._source.tagName.contains(tag4) ? ctx._source.tagName.replace(tag4,tag5):ctx._source.tagName.replace(tag4,tag3)",
    "params" : {
        "tag" : " 创意22 ","tag2":"创意22","tag3":" 创意55 ","tag4":" 纸上 ","tag5":"纸上55"
    },"scripted_upsert":true,
}

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/modules-scripting.html#_stored_fields

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/docs-update.html#_literal_doc_as_upsert_literal

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/_updating_documents.html

猜你喜欢

转载自m635674608.iteye.com/blog/2312723