private static void SetArray <TArray, TItem>(IIndexSettings s, IDictionary <string, JProperty> settings, string key, Action <TArray> assign,
                                                     Action <TItem> assign2, JsonSerializer serializer = null
                                                     )
        {
            if (!settings.ContainsKey(key))
            {
                return;
            }

            var v = settings[key];

            if (v.Value is JArray)
            {
                var value = serializer == null?v.Value.ToObject <TArray>() : v.Value.ToObject <TArray>(serializer);

                assign(value);
                s.Add(key, value);
            }
            else
            {
                var value = serializer == null?v.Value.ToObject <TItem>() : v.Value.ToObject <TItem>(serializer);

                assign2(value);
                s.Add(key, value);
            }
            settings.Remove(key);
        }
        private static void Set <T>(IIndexSettings s, IDictionary <string, JProperty> settings, string key, Action <T> assign, JsonSerializer serializer = null)
        {
            if (!settings.ContainsKey(key))
            {
                return;
            }
            var v     = settings[key];
            T   value = serializer == null?v.Value.ToObject <T>() : v.Value.ToObject <T>(serializer);

            assign(value);
            s.Add(key, value);
            settings.Remove(key);
        }