public void PASS_Create()
 {
     DocumentTimeToLive ttl = new DocumentTimeToLive(new Time.TimeValue("1d"));
     Assert.IsNotNull(ttl);
     Assert.AreEqual(new TimeSpan(1, 0, 0, 0), ttl.DefaultTimeToLive.TimeSpan);
     Assert.AreEqual(true, ttl.IsEnabled);
     Assert.AreEqual(IndexSettingEnum.NotAnalyzed, ttl.Index);
     Assert.AreEqual(true, ttl.Store);
 }
        public void PASS_Serialize()
        {
            DocumentTimeToLive ttl = new DocumentTimeToLive(new Time.TimeValue("1d"));
            string json = JsonConvert.SerializeObject(ttl);
            Assert.IsNotNull(json);

            string expectedJson = "{\"enabled\":true,\"default\":\"1d\"}";
            Assert.AreEqual(expectedJson, json);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> fieldDict = serializer.Deserialize<Dictionary<string, object>>(reader);
            DocumentTimeToLive ttl = new DocumentTimeToLive(new Time.TimeValue(fieldDict.GetString(_DEFAULT)));
            MappingBase.Deserialize(ttl, fieldDict);
            ttl.IsEnabled = fieldDict.GetBool(_IS_ENABLED, DocumentTimeToLive._IS_ENABLED_DEFAULT);

            return ttl;
        }