我的DynamboDB行项目如下所示:(它是给我的)
{
"id":"123456",
"date_time":"01062016 143212",
"payload":{
"type":"A",
"value":"temp value",
}
}
我在id + date_time上添加了索引。 如何在 payload.type 上添加索引?
感谢
答案 0 :(得分:0)
DynamoDB不支持public void GenerateReport(ReportParams parameters)
{
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.BufferOutput = false; // for large files
System.Web.HttpContext.Current.Response.ContentType = "application/zip";
const string filename = "test.zip";
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "filename=" + filename);
ThreadPool.SetMaxThreads(4, 4);
Log.Info("Starting the batch report");
using (var zip = new ZipFile())
{
var doneEvents = new ManualResetEvent[parameters.Contracts.Length];
for (int i = 0; i < parameters.Contracts.Length; i++)
{
var contract = parameters.Contracts[i];
doneEvents[i] = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(
ExportReport,
new ThreadInfo
{
Contract = contract,
Zip = zip,
DoneEvent = doneEvents[i]
});
}
WaitHandle.WaitAll(doneEvents);
zip.Save(System.Web.HttpContext.Current.Response.OutputStream);
}
Log.Info("Finishing the batch report");
}
protected void ExportReport(object obj)
{
var info = obj as ThreadInfo;
var reportDoc = new ReportDocument();
Log.Info("Thread Id {0} processing contract {1}", Thread.CurrentThread.ManagedThreadId, info.Contract);
SetPath(reportDoc);
SetDbInfo(reportDoc);
LoadParameter(reportDoc);
reportDoc.SetParameterValue("Contract", info.Contract);
reportDoc.ExportToDisk(
ExportFormatType.PortableDocFormat,
string.Format(@"C:\TempFile\{0}.pdf", info.Contract));
info.Zip.AddFile(string.Format(@"C:\TempFile\{0}.pdf", info.Contract));
Log.Info("Thread Id {0} finishing contract {1}", Thread.CurrentThread.ManagedThreadId, info.Contract);
reportDoc.Dispose();
info.DoneEvent.Set();
}
内嵌套字段的索引。
请参阅官方文档Improving Data Access with Secondary Indexes in DynamoDB。
索引的关键架构。索引键架构中的每个属性都必须是String,Number或Binary类型的顶级属性。不允许使用其他数据类型,包括文档和集合。