org.elasticsearch.common.collect.ImmutableMap Java Examples
The following examples show how to use
org.elasticsearch.common.collect.ImmutableMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatsReporterTest.java From elasticsearch-river-kafka with Apache License 2.0 | 5 votes |
public void testNormal() { Settings globalSettings = ImmutableSettings.settingsBuilder().put("cluster.name", "jason-hfs-cluster").build(); Map<String, Object> config = new HashMap<>(); config.put("statsd", ImmutableMap.<String, Object> builder().put("host", "localhost").put("port", "1234").put("prefix", "my_prefix").build()); StatsReporter r = new StatsReporter(new KafkaRiverConfig(new RiverSettings(globalSettings, config))); assertTrue(r.isEnabled()); }
Example #2
Source File: StatsReporterTest.java From elasticsearch-river-kafka with Apache License 2.0 | 5 votes |
public void testNotConfigured() { Settings globalSettings = ImmutableSettings.settingsBuilder().put("cluster.name", "jason-hfs-cluster").build(); Map<String, Object> config = new HashMap<>(); // no statsd config at all assertFalse(new StatsReporter(new KafkaRiverConfig(new RiverSettings(globalSettings, config))).isEnabled()); // missing host config.put("statsd", ImmutableMap.<String, Object> builder().put("port", "1234").put("prefix", "my_prefix").build()); assertFalse(new StatsReporter(new KafkaRiverConfig(new RiverSettings(globalSettings, config))).isEnabled()); }
Example #3
Source File: Importer.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
private Set<String> getMissingIndexes(Set<String> indexes) { try { ImmutableMap<String, IndexMetaData> foundIndices = getIndexMetaData(indexes); indexes.removeAll(foundIndices.keySet()); } catch (IndexMissingException e) { // all indexes are missing } return indexes; }
Example #4
Source File: Importer.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
private ImmutableMap<String, IndexMetaData> getIndexMetaData(Set<String> indexes) { ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() .filterRoutingTable(true) .filterNodes(true) .filteredIndices(indexes.toArray(new String[indexes.size()])); clusterStateRequest.listenerThreaded(false); ClusterStateResponse response = client.admin().cluster().state(clusterStateRequest).actionGet(); return ImmutableMap.copyOf(response.getState().metaData().indices()); }
Example #5
Source File: DumpParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
@Inject public DumpParser(QueryPhase queryPhase, FetchPhase fetchPhase) { Map<String, SearchParseElement> elementParsers = new HashMap<String, SearchParseElement>(); elementParsers.putAll(queryPhase.parseElements()); elementParsers.put("force_overwrite", new ExportForceOverwriteParseElement()); elementParsers.put("directory", directoryParseElement); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #6
Source File: ImportParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
public ImportParser() { Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>(); elementParsers.put("directory", new DirectoryParseElement()); elementParsers.put("compression", new ImportCompressionParseElement()); elementParsers.put("file_pattern", new FilePatternParseElement()); elementParsers.put("mappings", new ImportMappingsParseElement()); elementParsers.put("settings", new ImportSettingsParseElement()); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #7
Source File: ReindexParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
@Inject public ReindexParser(QueryPhase queryPhase, FetchPhase fetchPhase) { Map<String, SearchParseElement> elementParsers = new HashMap<String, SearchParseElement>(); elementParsers.putAll(queryPhase.parseElements()); elementParsers.put("explain", new ExplainParseElement()); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #8
Source File: SearchIntoParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
@Inject public SearchIntoParser(QueryPhase queryPhase, FetchPhase fetchPhase) { Map<String, SearchParseElement> elementParsers = new HashMap<String, SearchParseElement>(); elementParsers.putAll(queryPhase.parseElements()); elementParsers.put("fields", new FieldsParseElement()); elementParsers.put("targetNodes", new TargetNodesParseElement()); elementParsers.put("explain", new ExplainParseElement()); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #9
Source File: ExportParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
@Inject public ExportParser(QueryPhase queryPhase, FetchPhase fetchPhase) { Map<String, SearchParseElement> elementParsers = new HashMap<String, SearchParseElement>(); elementParsers.putAll(queryPhase.parseElements()); elementParsers.put("fields", new FieldsParseElement()); elementParsers.put("output_cmd", new ExportOutputCmdParseElement()); elementParsers.put("output_file", new ExportOutputFileParseElement()); elementParsers.put("force_overwrite", new ExportForceOverwriteParseElement()); elementParsers.put("compression", new ExportCompressionParseElement()); elementParsers.put("explain", new ExplainParseElement()); elementParsers.put("mappings", new ExportMappingsParseElement()); elementParsers.put("settings", new ExportSettingsParseElement()); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #10
Source File: RestImportActionTest.java From elasticsearch-inout-plugin with Apache License 2.0 | 5 votes |
@Test public void testMappings() { esSetup.execute(createIndex("index1")); String path = getClass().getResource("/importdata/import_9").getPath(); executeImportRequest("{\"directory\": \"" + path + "\", \"mappings\": true}"); ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest().filteredIndices("index1"); ImmutableMap<String, MappingMetaData> mappings = ImmutableMap.copyOf( esSetup.client().admin().cluster().state(clusterStateRequest).actionGet().getState().metaData().index("index1").getMappings()); assertEquals("{\"1\":{\"_timestamp\":{\"enabled\":true,\"store\":true},\"_ttl\":{\"enabled\":true,\"default\":86400000},\"properties\":{\"name\":{\"type\":\"string\",\"store\":true}}}}", mappings.get("1").source().toString()); }
Example #11
Source File: CassandraRiverIntegrationTest.java From cassandra-river with Apache License 2.0 | 4 votes |
@Test public void testImportWithRows() throws Exception { registerRiver(ImmutableMap.of("rows", 20), null); }
Example #12
Source File: RestoreParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 4 votes |
public RestoreParser() { Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>(); elementParsers.put("directory", new DirectoryParseElement()); this.elementParsers = ImmutableMap.copyOf(elementParsers); }
Example #13
Source File: ReindexParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 4 votes |
@Override protected ImmutableMap<String, SearchParseElement> getElementParsers() { return elementParsers; }
Example #14
Source File: SearchIntoParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 4 votes |
@Override protected ImmutableMap<String, SearchParseElement> getElementParsers() { return elementParsers; }
Example #15
Source File: AbstractSearchIntoParser.java From elasticsearch-inout-plugin with Apache License 2.0 | 2 votes |
/** * Get the element parser map * @return */ protected abstract ImmutableMap<String, SearchParseElement> getElementParsers();