Package crate.elasticsearch.action.export

Examples of crate.elasticsearch.action.export.ExportRequest


import org.elasticsearch.client.internal.InternalClient;

public class ExportRequestBuilder extends ActionRequestBuilder<ExportRequest, ExportResponse, ExportRequestBuilder> {

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


        esSetup2.client().admin().cluster().prepareHealth().setWaitForGreenStatus().
            setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();

        // Do dump request
        String source = "{\"force_overwrite\": true, \"directory\":\"/tmp/multipleNodes\"}";
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source(source);
        ExportResponse response = esSetup.client().execute(
                DumpAction.INSTANCE, exportRequest).actionGet();

        // The two shard results are from different nodes and have no failures
        assertEquals(0, response.getFailedShards());
View Full Code Here

    /**
     * Helper method to delete an already existing dump directory
     */
    private void deleteDefaultDir() {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"dump\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
View Full Code Here

     * async callback and writes result in response member variable.
     *
     * @param source
     */
    private ExportResponse executeDumpRequest(String source) {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source(source);
        return esSetup.client().execute(DumpAction.INSTANCE, exportRequest).actionGet();
    }
View Full Code Here

    /**
     * Execute a dump request with a JSON string as source query. Waits for
     * async callback and writes result in response member variable.
     */
    private ExportResponse executeDumpRequest() {
        ExportRequest exportRequest = new ExportRequest();
        return esSetup.client().execute(DumpAction.INSTANCE, exportRequest).actionGet();
    }
View Full Code Here

    protected Action<ExportRequest, ExportResponse, ExportRequestBuilder> action() {
        return ExportAction.INSTANCE;
    }

    public void handleRequest(final RestRequest request, final RestChannel channel) {
        ExportRequest exportRequest = new ExportRequest(RestActions.splitIndices(request.param("index")));

        if (request.hasParam("ignore_indices")) {
            exportRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices")));
        }
        exportRequest.listenerThreaded(false);
        try {
            BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
            if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
                // since we don't spawn, don't allow no_threads, but change it to a single thread
                operationThreading = BroadcastOperationThreading.SINGLE_THREAD;
            }
            exportRequest.operationThreading(operationThreading);
            if (request.hasContent()) {
                exportRequest.source(request.content(), request.contentUnsafe());
            } else {
                String source = request.param("source");
                if (source != null) {
                    exportRequest.source(source);
                } else {
                    BytesReference querySource = RestActions.parseQuerySource(request);
                    if (querySource != null) {
                        exportRequest.source(querySource, false);
                    }
                }
            }
            exportRequest.routing(request.param("routing"));
            exportRequest.types(splitTypes(request.param("type")));
            exportRequest.preference(request.param("preference", "_primary"));
        } 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

            setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();

        makeNodeDataLocationDirectories("myExport");

        // export data and recreate empty index
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"myExport/export.${shard}.${index}.json\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true}");
        esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();
        esSetup.execute(deleteAll(), createIndex("users").withSettings(
                fromClassPath("essetup/settings/test_a.json")).withMapping("d",
                        fromClassPath("essetup/mappings/test_a.json")));
View Full Code Here

    /**
     * Make a subdirectory in each node's node data location.
     * @param directory
     */
    private void makeNodeDataLocationDirectories(String directory) {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"" + directory + "\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
View Full Code Here

        request.source(source);
        return esSetup.client().execute(RestoreAction.INSTANCE, request).actionGet();
    }

    private ExportResponse executeDumpRequest(String source) {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source(source);
        return esSetup.client().execute(DumpAction.INSTANCE, exportRequest).actionGet();
    }
View Full Code Here

    /**
     * Helper method to delete an already existing dump directory
     */
    private void deleteDefaultDir() {
        ExportRequest exportRequest = new ExportRequest();
        exportRequest.source("{\"output_file\": \"dump\", \"fields\": [\"_source\", \"_id\", \"_index\", \"_type\"], \"force_overwrite\": true, \"explain\": true}");
        ExportResponse explain = esSetup.client().execute(ExportAction.INSTANCE, exportRequest).actionGet();

        try {
            Map<String, Object> res = toMap(explain);
            List<Map<String, String>> list = (ArrayList<Map<String, String>>) res.get("exports");
View Full Code Here

TOP

Related Classes of crate.elasticsearch.action.export.ExportRequest

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.