gpt4 book ai didi

elasticsearch - 使用NEST在索引上设置Elasticsearch时间戳路径吗?

转载 作者:行者123 更新时间:2023-12-02 22:17:41 27 4
gpt4 key购买 nike

我需要使用NEST为我的索引添加时间戳路径,不知道如何实现:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html

我一直在搞怪NEST,但我无法弄清楚。

我一直在这里阅读文档,但没有找到我想要的东西:
http://nest.azurewebsites.net/nest/quick-start.html

最佳答案

使用流畅的API,可以在创建索引时完成此操作:

var response = client.CreateIndex("myindex", c => c
.AddMapping<MyType>(m => m
.MapFromAttributes()
.TimestampField(t => t
.SetDisabled(false)
.SetPath(o => o.MyTimestampField)
)
)
);

或更新现有索引:

var response = client.Map<MyType>(m => m
.TimestampField(t => t
.SetDisabled(false)
.SetPath(o => o.MyTimestampField)
)
);

希望能有所帮助。

关于elasticsearch - 使用NEST在索引上设置Elasticsearch时间戳路径吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24493492/

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