c# - Elastic Search 的每日新索引
问题描述
我在 Elastic 有一个索引 time_series。
PUT time_series
{
"settings": {
"number_of_shards": 3
},
"mappings": {
"timeseries": {
"properties": {
"timestamp" : {
"type" : "date",
"format": "MM/dd/yyyy HH:mm:ss"
},
"value" : { "type" : "double" },
"recordid" : { "type" : "integer" }
}
}
}
}
从 C# 中,我向索引提供数据。我想要一个每天的新索引,比如
- time_series_19050 2
- time_series_19050 3
- ...
到目前为止,我知道我需要设置一个模板。我试过这个,但我得到一个状态= 400。
PUT _template/template_1
{
"index_patterns": ["time_series*"],
"settings": {
"number_of_shards": 1
},
"mappings": {
"timeseries": {
"enabled": false
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "_yyyyMMDD"
}
}
}
}
如何获取每天的新索引?
我需要用当前日期调整 C# 代码中的索引还是自动进入每日索引?
解决方案
我遇到了几乎同样的问题。我所做的是创建一个控制台项目(因为我还有其他操作要做),每次创建新索引 = 00:01:00。(控制台项目每 5 分钟触发一次)。请参阅此链接,可能会对您有所帮助https://discuss.elastic.co/t/elasticsearch-for-logging-how-to-configure-automatic-creation-of-the-new-index-every-day/19467/3
推荐阅读
- dataweave - For Loop dataweave mulesoft 问题
- node.js - Receive socket.io messages outside of connection
- angular - 将 JSON 查询的字段写入文件 Angular
- python - Extract values from a list using a numpy range of indices between every two numbers
- ada - External configuration of Project_Version in gpr file
- javascript - Issue with Pagination in nodejs with mongoose and query optimization
- amazon-dynamodb - Localstack + Jest: DynamoDB throws ResourceNotFoundException on deleteTable for an existing table
- postman - How to change the variables form environment to collection level in postman
- python - 如何使用 colmun 名称旋转 pandas.dataframe
- python - 如何将字符串类型列的因子级别集中到pydatatable中的另一个列中?