can‘t be changed from nested to non-nested

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "object mapping [ty_scenic_list] can't be changed from nested to non-nested"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "object mapping [ty_scenic_list] can't be changed from nested to non-nested"
    },
    "status": 400
}

我的 mapping type 定义

{
    "mappings":{
         #这里定义了type
        "ty_zyb_product":{
            "properties":{
                "ty_corp_code":{
                    "type":"keyword"
                },
                "ty_parent_corp_code":{
                    "type":"keyword"
                },
                "ty_scenic_id":{
                    "type":"long"
                },
                "ty_product_id":{
                    "type":"keyword"
                },
                "ty_status":{
                    "type":"keyword"
                },
                "association":{
                    "type":"boolean"
                },
                "zyb_corp_code":{
                    "type":"keyword"
                },
                "zyb_scenic_id":{
                    "type":"keyword"
                },
                "zyb_scenic_name":{
                    "type":"text"
                },
                "zyb_product_code":{
                    "type":"keyword"
                },
                "zyb_product_name":{
                    "type":"text"
                },
                "createTime":{
                    "type":"date",
                    "format": "yyyy-MM-dd HH:mm:ss,SSS||yyyy-MM-dd HH:mm:ss||epoch_millis"
                },
                "modifyTime":{
                    "type":"date",
                    "format": "yyyy-MM-dd HH:mm:ss,SSS||yyyy-MM-dd HH:mm:ss||epoch_millis"
                },
                "ty_scenic_list": {
                    "type": "nested",
                    "properties": {
                        "ty_scenic_id_n": {
                            "type": "long"
                        },
                        "ty_status_n": {
                            "type": "long"
                        }
                    }
                }          
            }
        }
    }
}

报这个错误的原因其实很简单,请求地址没有写对

正确的写法

                        |   索引          |       type      |
http://192.168.*.*:9200/ty_zyb_product/ty_zyb_product

你可能感兴趣的:(elasticsearch)