无法使用Azure UI上传数据到Cosmos。

huangapple go评论111阅读模式
英文:

Not able to upload data to cosmos using Azure UI

问题

我想将数据上传到Cosmos DB(NoSQL API)。以下是我对表的分区键逻辑:

分区键:/x_id/location/name
唯一键:[/source, /type]

我要上传的JSON文件如下:

[
  {
    "x_id": "1",
    "type": "ROLL",
    "location": "10",
    "source": "A",
    "event_name": "B"
  },
  {
    "x_id": "2",
    "type": "ROLL",
    "location": "11",
    "source": "C",
    "event_name": "D"
  }
]

保存数据时出现以下错误:

Error bulk creating items for container table_name:
不能使用 'in' 运算符在 1 中搜索 'location'

但是,当我将单个项目添加到相同的容器时,一切正常,但进行批量上传时开始出现上述错误。

用于批量上传的选项:上传项目
无法使用Azure UI上传数据到Cosmos。

错误:
无法使用Azure UI上传数据到Cosmos。

有人可以帮忙解决这个问题吗?

英文:

I want to upload the data to cosmos DB (NoSQL API).
Here is my Partition key logic for the Table

partition key : /x_id/location/name
unique keys : [/source, /type]

The JSON file I want to upload is

[
  {
    "x_id": "1",
    "type": "ROLL",
    "location": "10",
    "source": "A",
    "event_name": "B"
  },
  {
    "x_id": "2",
    "type": "ROLL",
    "location": "11",
    "source": "C",
    "event_name": "D"
  }
]

It's giving me the below error for saving the data

Error bulk creating items for container table_name:
 Cannot use the 'in' operator to search for 'location' in 1

But when I add single items to the same container it's working fine, but when doing bulk upload it starts giving the above error.

Option used for bulk upload : Upload Item
无法使用Azure UI上传数据到Cosmos。

Error :
无法使用Azure UI上传数据到Cosmos。

Can anyone help with this?

答案1

得分: 1

  • 为了在 Cosmos DB 中创建分层分区键,
    /x_id/location/name 点击 添加分层分区键 以按顺序添加每个键。由于示例文档中没有名为 name 的列,我将其替换为 event_name

无法使用Azure UI上传数据到Cosmos。

  • 在上图中创建分区键后,项目被成功上传,没有出现任何错误。

无法使用Azure UI上传数据到Cosmos。

英文:
  • In order to create hierarchical partition key in cosmos db,
    /x_id/location/name click Add hierarchical partition key for adding each key in order. Since there is no column named name in the sample document shared, I replaced that with event_name.

无法使用Azure UI上传数据到Cosmos。

  • After creating partition key as in above image, items got uploaded without any error.

无法使用Azure UI上传数据到Cosmos。

huangapple
  • 本文由 发表于 2023年8月10日 17:15:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76874287.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定