CKAN 数据存储搜索无法获取特定字段
CKAN Datastore search for fetching particular fields not working
我创建了一个包含以下字段和数据的 CKAN 数据存储
"primary_key" : ["Book ID"],
"fields" :[
{"id":"Book ID","type":"number"},
{"id":"Book Name","type":"text"},
{"id":"Author","type":"text"},
{"id":"Publications","type":"text"},
{"id":"Price","type":"text"},
{"id":"Discount","type":"text"}
],
"records": [
{ "Book ID" :"1",
"Book Name" :"Book1",
"Author" :"Author1",
"Publications" :"Pub1",
"Price" :"895",
"Discount" :"5"
},
{ "Book ID" :"2",
"Book Name" :"Book2",
"Author" :"Author2",
"Publications" :"Pub2",
"Price" :"699",
"Discount" :"5"
},
{ "Book ID" :"3",
"Book Name" :"Book3",
"Author" :"Author3",
"Publications" :"Pub3",
"Price" :"500",
"Discount" :"10"
}]
我需要获取一些特定的字段。
我使用 datastore_search 并给出了我需要获取的字段。但是显示错误。
我的搜索码:
{ "resource_id": "740d27f5-790c-43d8-9d5d-23c8aab9303e",
"fields": [
{ "id": "Book Name"},
{ "id": "Author"}
],
"filters": {"Book Name": "Book1"}
}
"fields" 是列表或逗号分隔的字符串,在这里您将字段作为对象数组提供。
试试这个代码:
{
"resource_id": "740d27f5-790c-43d8-9d5d-23c8aab9303e",
"fields": "Book Name,Author",
"filters": {"Book Name": "Book1"}
}
我创建了一个包含以下字段和数据的 CKAN 数据存储
"primary_key" : ["Book ID"],
"fields" :[
{"id":"Book ID","type":"number"},
{"id":"Book Name","type":"text"},
{"id":"Author","type":"text"},
{"id":"Publications","type":"text"},
{"id":"Price","type":"text"},
{"id":"Discount","type":"text"}
],
"records": [
{ "Book ID" :"1",
"Book Name" :"Book1",
"Author" :"Author1",
"Publications" :"Pub1",
"Price" :"895",
"Discount" :"5"
},
{ "Book ID" :"2",
"Book Name" :"Book2",
"Author" :"Author2",
"Publications" :"Pub2",
"Price" :"699",
"Discount" :"5"
},
{ "Book ID" :"3",
"Book Name" :"Book3",
"Author" :"Author3",
"Publications" :"Pub3",
"Price" :"500",
"Discount" :"10"
}]
我需要获取一些特定的字段。 我使用 datastore_search 并给出了我需要获取的字段。但是显示错误。
我的搜索码:
{ "resource_id": "740d27f5-790c-43d8-9d5d-23c8aab9303e",
"fields": [
{ "id": "Book Name"},
{ "id": "Author"}
],
"filters": {"Book Name": "Book1"}
}
"fields" 是列表或逗号分隔的字符串,在这里您将字段作为对象数组提供。
试试这个代码:
{
"resource_id": "740d27f5-790c-43d8-9d5d-23c8aab9303e",
"fields": "Book Name,Author",
"filters": {"Book Name": "Book1"}
}