2014-06-30 39 views
1

我需要使用NEST时间戳路径添加到我的索引,不知道如何做到这一点: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html使用NEST在索引上设置elasticsearch时间戳路径?

我一直在搞乱NEST,但我不知道这一点。

我一直在这里阅读文档,但没有发现什么,我在寻找:

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

或更新: http://nest.azurewebsites.net/nest/quick-start.html

回答

3

使用流利的API,这可以在创建索引时完成现有索引:

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

希望有帮助。

相关问题