2014-06-30 40 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) 
) 
); 

希望有幫助。

相關問題