我有一個這樣的對象:我如何可以覆蓋屬性的類型和datat在ElasticSearch.NET
public class MyDate {
public DateTime Original { get; set; }
public string MungedFormatForAnotherSystem { get; set; }
}
public class ESClass {
public string Id { get;set; }
public MyDate LastUpdatedDate {get;set;}
}
我使用NEST客戶端這樣的:
var client = new ElasticClient();
client.Index(doc, i => i.Index("myindex");
我想要的是將MyDate序列化爲ES,只需要Original
部分,然後對其進行查詢即可。
由於依賴關係,我無法更改對象(如果必須更改依賴關係,我會嘗試避免這種情況)。
有沒有辦法做到這一點,或者是一廂情願?
所以,'MungedFormatForAnotherSystem'不應被序列化,並存儲在Elasticsearch以任何方式做到這一點? –
正確,它需要以相同的名稱存儲,但是作爲日期而不是嵌套對象。 – Martin