// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggestSettingsException.java
// public class SuggestSettingsException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggestSettingsException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggestSettingsException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggestSettingsException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggesterException.java
// public class SuggesterException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggesterException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggesterException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggesterException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.suggest.exception.SuggestSettingsException;
import org.codelibs.fess.suggest.exception.SuggesterException;
import org.opensearch.action.get.GetResponse;
import org.opensearch.client.Client;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.index.IndexNotFoundException;
                        arraySettings.add(new Tuple<>(key, element));
                    }
                } else {
                    defaultSettings.put(key, value);
                }
            });
            set(defaultSettings);

            final List<Tuple<String, Object>> defaultArraySettings = defaultArraySettings();
            defaultArraySettings.addAll(arraySettings);
            defaultArraySettings.forEach(t -> array().add(t.v1(), t.v2()));
        }
    }

    public Object get(final String key) {
        final GetResponse getResponse =
                client.prepareGet().setIndex(settingsIndexName).setId(settingsId).execute().actionGet(getSearchTimeout());
        if (!getResponse.isExists()) {
            return null;
        }
        final Map<String, Object> map = getResponse.getSource();
        return map.get(key);
    }

    public String getAsString(final String key, final String defaultValue) {
        final Object obj = get(key);

        final String value;
        if (obj == null) {
            value = defaultValue;
// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggestSettingsException.java
// public class SuggestSettingsException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggestSettingsException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggestSettingsException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggestSettingsException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggesterException.java
// public class SuggesterException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggesterException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggesterException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggesterException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }


// Path: src/main/java/org/codelibs/fess/suggest/settings/SuggestSettings.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.suggest.exception.SuggestSettingsException;
import org.codelibs.fess.suggest.exception.SuggesterException;
import org.opensearch.action.get.GetResponse;
import org.opensearch.client.Client;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.index.IndexNotFoundException;

                        arraySettings.add(new Tuple<>(key, element));
                    }
                } else {
                    defaultSettings.put(key, value);
                }
            });
            set(defaultSettings);

            final List<Tuple<String, Object>> defaultArraySettings = defaultArraySettings();
            defaultArraySettings.addAll(arraySettings);
            defaultArraySettings.forEach(t -> array().add(t.v1(), t.v2()));
        }
    }

    public Object get(final String key) {
        final GetResponse getResponse =
                client.prepareGet().setIndex(settingsIndexName).setId(settingsId).execute().actionGet(getSearchTimeout());
        if (!getResponse.isExists()) {
            return null;
        }
        final Map<String, Object> map = getResponse.getSource();
        return map.get(key);
    }

    public String getAsString(final String key, final String defaultValue) {
        final Object obj = get(key);

        final String value;
        if (obj == null) {
            value = defaultValue;
        } else {