amazon-web-services - Elasticsearch:使用特殊领域作为模板的PK改进研究
问题描述
以下是 ElasticSearch 中的一个模板,我的问题是,是否有办法推广其中一个字段,例如timeStamp
,作为主键来帮助查询期间的研究;就像它通常发生在数据库上一样。
{
"order": 0,
"template": "simsamples-*",
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"ProbeSamples": {
"properties": {
"date": {
"index": "no",
"type": "string"
},
"timeStamp": {
"format": "epoch_second",
"type": "date"
},
"temperatures": {
"type": "double"
},
"id": {
"index": "not_analyzed",
"type": "string"
}
}
}
}
}
解决方案
elasticsearch中没有主键。每个文档都自动有一个_id
字段,这是一种主键,因为它是一个唯一标识符。
Elasticsearch 正在为每个字段创建索引,因此无需指定一个作为主键。
推荐阅读
- docker - 在 grafana 中配置多个数据源
- python - 带有 python 的 Selenium webdriver 抛出 requests.exceptions.MissingSchema
- php - Html 表单标签不去行动中的地址
- java - 包“junit.framework”不存在
- elixir - 如何手动访问phoenix中的500错误页面?
- javascript - 如何将for循环中一个数组的值添加到另一个数组并将其推送到对象
- javascript - 通过单击 HTML 中的按钮删除数组元素?
- c - 声明 void 指针以向下游推送类型处理
- python - 如何通过 pandas 中的公共列 ID 合并表 T1 (M x P) 和表 T2 (M x Q),使得结果表是 T3 (P x Q)?
- java - 如何设置 Netbeans 11 在分发 jar 文件中包含 jdbc 驱动程序?