【问题标题】:Is it possible to add an Alias using a filter with wildcards in Elasticsearch?是否可以在 Elasticsearch 中使用带通配符的过滤器添加别名?
【发布时间】:2023-02-22 09:31:09
【问题描述】:

这是我到目前为止所做的......为单个文档添加了一个别名:

x="15-44931"
es.indices.update_aliases({
"actions": [
   { "add":    { "index": 'job_old', "alias": x,"filter":{"term":{"path.virtual.keyword":"/15-44931/4.pdf"}}}}

    ]
  })

因此,下面只是将别名“15-44931 添加到带有 path.virtual =”/15-44931/4.pdf 的文档中。是否可以使用通配符,以便使用类似“/”的内容将别名添加到多个文档中15-44931/*"?

我努力了:

{ "add":    { "index": 'job_old', "alias": x,"filter":{"term":{"path.virtual":"/15-44931/*"}}}}

它不工作...

【问题讨论】:

    标签: python elasticsearch alias


    【解决方案1】:

    这最终奏效了:

    { "add":    { "index": 'job_old', "alias": x,"filter":{"regexp":{"path.virtual.keyword":"/"+x+".*"}}}}
    

    【讨论】:

      猜你喜欢
      • 2010-10-31
      • 2019-04-09
      • 2011-01-02
      • 1970-01-01
      • 2018-05-21
      • 1970-01-01
      • 2023-03-28
      • 2021-03-07
      • 1970-01-01
      相关资源
      最近更新 更多