使用 reindex 来修改 elasticsearch 索引mapping

作者: root007 分类: EFK,Linux 发布时间: 2020-01-15 10:27

elasticsearch 在创建好index之后mapping是不能动态修改,如果需要改动只能通过新增字段或者reindex api 来迁移数据,创建新的索引 。 没有通过动态模板来为这个字段指定类型, elasticsearch 默认将这种结构的数据设置成了 Object 类型

# 重新创建index在迁移数据

1、例如:
首先创建并设置好mapping:

{
  "mappings": {
    "properties": {
        "geoip": {
           "properties": {     
              "location": {
                 "ignore_malformed": "true",
                 "type": "geo_point"
                }
           }
        }
    }
  }
}
PUT _template/logstash
{
  "template": "logstash-*",
  "settings": {
    "index.refresh_interval" : "60s",
    "number_of_shards": 2
  },
  "mappings": {
    "properties": {
        "geoip": {
           "properties": {     
              "location": {
                 "ignore_malformed": "true",
                 "type": "geo_point"
                }
           }
        }

    }
  }
}

创建新的index

PUT logstash-ali-k8s-nginx-ingress-controller-b275w-new-2020.01.12
POST _reindex
{
  "source": {
    "index": "logstash-ali-k8s-nginx-ingress-controller-b275w-2020.01.12"
  },
  "dest": {
    "index": "logstash-ali-k8s-nginx-ingress-controller-b275w-new-2020.01.12"
  }
}

发表评论

邮箱地址不会被公开。 必填项已用*标注


  • http://ediconcept.odns.fr/maillotdefootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher2022.html
  • https://sergiofajardo.co/maillotdefootpascher.html
  • https://sergiofajardo.co/maillotsfootballpascher.html
  • https://sergiofajardo.co/maillotsfootpascherfrance.html
  • https://allphonetoys.com/maillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotsdefootball.html
  • http://samosystem.nichost.ru/maillotdefootpascher.html
  • http://samosystem.nichost.ru/nouveaumodèlemaillotdefoot.html
  • http://samosystem.nichost.ru/pascherfemmesfootballjersey.html
  • http://w96397on.beget.tech/maillotdefootpascher.html
  • http://w96397on.beget.tech/pascherfootballt-shirts.html
  • http://w96397on.beget.tech/paschermaillotsdefootpromo.html
  • http://wesleywang.acsite.org/maillotdefootpascher.html
  • https://wesleywang.acsite.org/repliquemaillotsdefootballlivraisongratuite.html
  • https://wesleywang.acsite.org/retrovintagesoccerjerseys.html
  • https://www.rnkhabri.com/maillotdefootpascher.html
  • https://www.rnkhabri.com/personnaliséenfantssoccerjersey.html
  • https://www.rnkhabri.com/personnaliséfemmessoccervêtements.html
  • https://www.oujdacity.net/maillotdefootpascher.html
  • https://www.oujdacity.net/sitedemaillotdefootpascher.html
  • https://www.oujdacity.net/survetementdefoot.html
  • https://infendo.com/maillotdefootpascher.html
  • https://infendo.com/survetementdefootpascher.html
  • https://infendo.com/uniformedefootballdesjeunes.html
  • https://planitagency.com/maillotdefootpascher.html
  • https://planitagency.com/ventemaillotdefootpascherthailande2022.html
  • https://planitagency.com/vesteequipedefoot.html
  • http://immergut.com.br
  • https://immobiliarelerosemarine.com
  • https://immobilienfotografie24.de
  • http://immobilier-lemaroc.com
  • https://imobilideranca.com.br
  • https://impactdigital.space
  • https://imperibiza.com
  • https://impexworldltd.com
  • https://implant.gen.tr
  • https://impread.com
  • http://improveyourdance.com
  • http://improvisamos.com
  • http://impulsarh.com.ar
  • http://inamakethat.com
  • http://inanna.be
  • https://incomementorbox.com
  • https://incomerepairpro.com
  • https://indiatvnewss.com
  • https://indoranews.com
  • https://infendo.com
  • https://infinitebankingagenttraining.com
  • https://infinnium.com
  • http://influenceyourway.com
  • http://infocarbrokers.net
  • http://infohealth-usa.com
  • https://informatic-crew.fr
  • https://informatiotech.com
  • https://informeblumenau.com
  • https://infos-grossesse.fr
  • https://ingatlanmagus.com