gpt4 book ai didi

c# - Elasticsearch中的每日新索引

转载 作者:行者123 更新时间:2023-12-02 23:53:23 25 4
gpt4 key购买 nike

我在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

    关于c# - Elasticsearch中的每日新索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55948112/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com