Package org.elasticsearch.common.settings

Examples of org.elasticsearch.common.settings.Settings$Builder


                    for (IndexMetaData indexMetaData : metaData) {
                        builder.startObject(indexMetaData.index());

                        builder.startObject("settings");
                        Settings settings = settingsFilter.filterSettings(indexMetaData.settings());
                        for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
                            builder.field(entry.getKey(), entry.getValue());
                        }
                        builder.endObject();

                        builder.endObject();
View Full Code Here


                            builder.field("template", templateMetaData.template());
                            builder.field("order", templateMetaData.order());

                            builder.startObject("settings");
                            Settings settings = settingsFilter.filterSettings(templateMetaData.settings());
                            for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
                                builder.field(entry.getKey(), entry.getValue());
                            }
                            builder.endObject();

                            builder.startObject("mappings");
                            for (Map.Entry<String, CompressedString> entry : templateMetaData.mappings().entrySet()) {
                                byte[] mappingSource = entry.getValue().uncompressed();
                                XContentParser parser = XContentFactory.xContent(mappingSource).createParser(mappingSource);
                                Map<String, Object> mapping = parser.map();
                                if (mapping.size() == 1 && mapping.containsKey(entry.getKey())) {
                                    // the type name is the root value, reduce it
                                    mapping = (Map<String, Object>) mapping.get(entry.getKey());
                                }
                                builder.field(entry.getKey());
                                builder.map(mapping);
                            }
                            builder.endObject();


                            builder.endObject();
                        }
                        builder.endObject();

                        builder.startObject("indices");
                        for (IndexMetaData indexMetaData : state.metaData()) {
                            builder.startObject(indexMetaData.index(), XContentBuilder.FieldCaseConversion.NONE);

                            builder.field("state", indexMetaData.state().toString().toLowerCase());

                            builder.startObject("settings");
                            Settings settings = settingsFilter.filterSettings(indexMetaData.settings());
                            for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
                                builder.field(entry.getKey(), entry.getValue());
                            }
                            builder.endObject();

                            builder.startObject("mappings");
View Full Code Here

        this.concurrentStreamPool = DynamicExecutors.newScalingThreadPool(1, concurrentStreams, TimeValue.timeValueSeconds(5).millis(), EsExecutors.daemonThreadFactory(settings, "[s3_stream]"));

        logger.debug("Using uri [{}], path [{}], concurrent_streams [{}]", uri, hPath, concurrentStreams);

        Configuration conf = new Configuration();
        Settings hdfsSettings = settings.getByPrefix("hdfs.conf.");
        for (Map.Entry<String, String> entry : hdfsSettings.getAsMap().entrySet()) {
            conf.set(entry.getKey(), entry.getValue());
        }

        fileSystem = FileSystem.get(URI.create(uri), conf);
View Full Code Here

* @author kimchy (shay.banon)
*/
public class IndexQueryParserPlugin2Tests {

    @Test public void testCustomInjection() {
        Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS;

        IndexQueryParserModule queryParserModule = new IndexQueryParserModule(settings);
        queryParserModule.addQueryParser("my", PluginJsonQueryParser.class);
        queryParserModule.addFilterParser("my", PluginJsonFilterParser.class);

View Full Code Here

* @author kimchy (shay.banon)
*/
public class IndexQueryParserModuleTests {

    @Test public void testCustomInjection() {
        Settings settings = settingsBuilder()
                .put("index.queryparser.query.my.type", MyJsonQueryParser.class)
                .put("index.queryparser.query.my.param1", "value1")
                .put("index.queryparser.filter.my.type", MyJsonFilterParser.class)
                .put("index.queryparser.filter.my.param2", "value2")
                .put("index.cache.filter.type", "none")
View Full Code Here

* @author kimchy (shay.banon)
*/
public class AnalysisModuleTests {

    @Test public void testSimpleConfigurationJson() {
        Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/test1.json").build();
        testSimpleConfiguration(settings);
    }
View Full Code Here

        Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/test1.json").build();
        testSimpleConfiguration(settings);
    }

    @Test public void testSimpleConfigurationYaml() {
        Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/test1.yml").build();
        testSimpleConfiguration(settings);
    }
View Full Code Here

    @Test public void testWordListPath() throws Exception {
        Environment env = new Environment(ImmutableSettings.Builder.EMPTY_SETTINGS);
        String[] words = new String[]{"donau", "dampf", "schiff", "spargel", "creme", "suppe"};

        File wordListFile = generateWordList(words);
        Settings settings = settingsBuilder().loadFromSource("index: \n  word_list_path: " + wordListFile.getAbsolutePath()).build();

        Set<String> wordList = Analysis.getWordSet(env, settings, "index.word_list");
        MatcherAssert.assertThat(wordList.size(), equalTo(6));
        MatcherAssert.assertThat(wordList, hasItems(words));
    }
View Full Code Here

*/
public class CompoundAnalysisTests {

    @Test public void testDefaultsCompoundAnalysis() throws Exception {
        Index index = new Index("test");
        Settings settings = getJsonSettings();
        Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings), new EnvironmentModule(new Environment(settings)), new IndicesAnalysisModule()).createInjector();
        Injector injector = new ModulesBuilder().add(
                new IndexSettingsModule(index, settings),
                new IndexNameModule(index),
                new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class)))
View Full Code Here

* @author kimchy (shay.banon)
*/
public class IndexQueryParserPluginTests {

    @Test public void testCustomInjection() {
        Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS;

        IndexQueryParserModule queryParserModule = new IndexQueryParserModule(settings);
        queryParserModule.addProcessor(new IndexQueryParserModule.QueryParsersProcessor() {
            @Override public void processXContentQueryParsers(XContentQueryParsersBindings bindings) {
                bindings.processXContentQueryParser("my", PluginJsonQueryParser.class);
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.settings.Settings$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.