ES 修改索引步骤

 

修改索引字段步骤
1、新建索引新增字段索引
PUT biddingindex_new
{
  "settings": {
    "number_of_shards": 3,
    "number_of_replicas": 1
  },
  "mappings": {
    "properties": {
      "BidMode": {
        "type": "long"
      },
      "LoadStartTime": {
        "type": "date"
      },
      "beginLocation": {
        "type": "geo_point"
      },
      "beginPoint": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "beginPointCity": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "beginPointProvince": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "bussinessSystemCode": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "cargoId": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "cargoType": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "code": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "endLocation": {
        "type": "geo_point"
      },
      "endPoint": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "endPointCity": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "endPointProvince": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "estimatedEndTime": {
        "type": "date"
      },
      "gid": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "isAppointCandidate": {
        "type": "boolean"
      },
      "orderId": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "planEndTime": {
        "type": "date"
      },
      "publishTime": {
        "type": "date"
      },
      "roundsId": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "startTime": {
        "type": "date"
      },
      "status": {
        "type": "long"
      }
    }
  }
}

2、重建索引
POST _reindex
{
  "source": {
    "index": "biddingindex"
  },
  "dest": {
    "index": "biddingindex_new"
  }
}

3、删除索引:DELETE biddingindex

4、增加新索引别名
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "biddingindex_new",
        "alias": "biddingindex"
      }
    }
  ]
}

  

posted @ 2021-03-17 14:10  清风拂人  阅读(2356)  评论(0编辑  收藏  举报