gpt4 book ai didi

json - 对象映射[位置]不能从嵌套更改为非嵌套

转载 作者:行者123 更新时间:2023-12-02 22:23:46 26 4
gpt4 key购买 nike

步骤1:

放入http://localhost:9200/hindex

  {
"mappings" : {
"hProvider":{
"properties": {
"iPid" : {
"type": "string"
},
"pType" : {
"type" : "string"
},
"pInfo" : {
"properties":{
"businessName": {
"type": "string"
},
"dob": {
"type": "string"
},
"firstName": {
"type": "string"
},
"gender": {
"type": "string",
"index": "not_analyzed"
}
}
},
"locations" : {
"type" : "nested",
"properties" : {
"addressInfo" : {
"properties" : {
"city": {
"type": "string",
"index": "not_analyzed"
},
"county": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
}
}

GET http://localhost:9200/hindex/_mapping
{"hindex":{"mappings":{"hProvider":{"properties":{"iPid":{"type":"string"},"locations":{"type":"nested","properties":{"addressInfo":{"properties":{"city":{"type":"string","index":"not_analyzed"},"county":{"type":"string","index":"not_analyzed"}}}}},"pInfo":{"properties":{"businessName":{"type":"string"},"dob":{"type":"string"},"firstName":{"type":"string"},"gender":{"type":"string","index":"not_analyzed"}}},"pType":{"type":"string"}}}}}}
  • 插入数据

  • POST http://localhost:9200/hindex/prof/1/?_create
    {
    "iPid" : "xyz",
    "pType" : "HealthCareProfessional",
    "pInfo": {
    "businessName" : "hdata",
    "firstName" : "Dawoods",
    "dob" : "11/18/1975",
    "gender" : "male"
    },
    "locations" : [
    {
    "addressInfo" : { "city" : "Olney", "county" : "UnitedStates" }
    },
    {
    "addressInfo" : { "city" : "Rivers", "county" : "United States" }
    }
    ]
    }

    回应:
    {"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[node-1][10.194.153.161:9300][indices:data/write/index[p]]"}],"type":"illegal_argument_exception","reason":"object mapping [locations] can't be changed from nested to non-nested"},"status":400}

    尝试过使用不同的数据集但没有运气,那么数据上的错误可能是什么?

    最佳答案

    您的第三个命令不正确,它未在正确的映射类型上运行,并且尝试使用非嵌套的prof字段创建一个名为locations的新映射类型,该字段与同一索引中hProvider映射类型中的嵌套嵌套类型冲突。

    更改为此:

    POST http://localhost:9200/hindex/hProvider/1/?_create
    ^
    |
    change this

    关于json - 对象映射[位置]不能从嵌套更改为非嵌套,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39037883/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com