Examples of ImportRequest


Examples of crate.elasticsearch.action.import_.ImportRequest

import crate.elasticsearch.action.import_.ImportResponse;

public class ImportRequestBuilder extends ActionRequestBuilder<ImportRequest, ImportResponse, ImportRequestBuilder> {

    public ImportRequestBuilder(Client client) {
        super((InternalClient) client, new ImportRequest());
    }
View Full Code Here

Examples of crate.elasticsearch.action.import_.ImportRequest

    protected Action action() {
        return ImportAction.INSTANCE;
    }

    public void handleRequest(final RestRequest request, final RestChannel channel) {
        ImportRequest importRequest = new ImportRequest();
        importRequest.listenerThreaded(false);
        try {
            if (request.hasContent()) {
                importRequest.source(request.content(), request.contentUnsafe());
            } else {
                String source = request.param("source");
                if (source != null) {
                    importRequest.source(source);
                } else {
                    BytesReference querySource = RestActions.parseQuerySource(request);
                    if (querySource != null) {
                        importRequest.source(querySource, false);
                    }
                }
            }
            importRequest.index(request.param("index"));
            importRequest.type(request.param("type"));
        } catch (Exception e) {
            try {
                XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject()));
            } catch (IOException e1) {
View Full Code Here

Examples of crate.elasticsearch.action.import_.ImportRequest

     * into the given index/type.
     */
    @Test
    public void testImportIntoIndexAndType() {
        String path = getClass().getResource("/importdata/import_2").getPath();
        ImportRequest request = new ImportRequest();
        request.index("another_index");
        request.type("e");
        request.source("{\"directory\": \"" + path + "\"}");
        ImportResponse response = esSetup.client().execute(ImportAction.INSTANCE, request).actionGet();

        List<Map<String, Object>> imports = getImports(response);
        Map<String, Object> nodeInfo = imports.get(0);
        assertTrue(nodeInfo.get("imported_files").toString().matches(
View Full Code Here

Examples of crate.elasticsearch.action.import_.ImportRequest

        }
        return (List<Map<String, Object>>) res.get(key);
    }

    private ImportResponse executeImportRequest(String source) {
        ImportRequest request = new ImportRequest();
        request.source(source);
        return esSetup.client().execute(ImportAction.INSTANCE, request).actionGet();
    }
View Full Code Here

Examples of crate.elasticsearch.action.import_.ImportRequest

        }
        return (List<Map<String, Object>>) res.get(key);
    }

    private ImportResponse executeRestoreRequest(String source) {
        ImportRequest request = new ImportRequest();
        request.source(source);
        return esSetup.client().execute(RestoreAction.INSTANCE, request).actionGet();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.