Java Code Examples for org.elasticsearch.common.collect.ImmutableMap#copyOf()

The following examples show how to use org.elasticsearch.common.collect.ImmutableMap#copyOf() . 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: Importer.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
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 2
Source File: DumpParser.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: ImportParser.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
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 4
Source File: ReindexParser.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: SearchIntoParser.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: ExportParser.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@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 7
Source File: RestImportActionTest.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: RestoreParser.java    From elasticsearch-inout-plugin with Apache License 2.0 4 votes vote down vote up
public RestoreParser() {
    Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>();
    elementParsers.put("directory", new DirectoryParseElement());
    this.elementParsers = ImmutableMap.copyOf(elementParsers);
}