ES映射操作 已创建的ES索引 增加映射字段(类似DB库增加给表增加字段)一样

ES已存在的索引下添加映射

解释如下:给ticketing_order_info的索引,增加映射字段verificationCodeState,字段类型为integer

实现:

PUT /ticketing_order_info/_mapping/
{
    "properties": {
        "verificationCodeState": {
            "type": "integer"
        }
    }
}

PUT /ticketing_order_info/_mapping/
{
    "properties": {
        "isTouristGroupName": {
            "type": "keyword",
              "ignore_above": 256
        }
    }
}

解释如下:给ticketing_order_info的索引,增加映射字段payTypeName,字段类型为String,并设置为关键字

PUT /ticketing_order_info/_mapping/
{
    "properties": {
        "payTypeName": {
            "type": "keyword",
              "ignore_above": 256
        }
    }
}


PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "delFlag": {
            "type": "integer"
        }
    }
}

解释如下:给ticketing_order_details的索引,增加映射字段touristGroupId,字段类型为long


PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "touristGroupId": {
            "type": "long"
        }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "seatNumber": {
            "type": "keyword",
            "ignore_above": 256
        }
    }
}


PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "createBy": {
            "type": "keyword",
            "ignore_above": 256
        }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "updateBy": {
            "type": "keyword",
            "ignore_above": 256
        }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "remarks": {
            "type": "keyword",
            "ignore_above": 256
        }
    }
}

解释如下:给ticketing_order_details的索引,增加映射字段showTime,字段类型为date,并设置自定义时间格式

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "showTime": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis"
            }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "createTime": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis"
            }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "updateTime": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd'T'HH:mm:ss'+08:00' || strict_date_optional_time || epoch_millis"
            }
    }
}

PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "businessCode": {
            "type": "integer"
        }
    }
}


PUT /ticketing_order_details/_mapping/
{
    "properties": {
        "businessKindId": {
            "type": "long"
        }
    }
}

你可能感兴趣的:(elasticsearch,java)