Examples of BytesReference


Examples of org.elasticsearch.common.bytes.BytesReference

            if (transferStatus == null) {
                throw new IndexShardClosedException(onGoingRecovery.shardId());
            }

            BytesReference content = request.content();
            if (!content.hasArray()) {
                content = content.toBytesArray();
            }
            transferStatus.outputStream().write(
                content.array(), content.arrayOffset(), content.length()
            );

            if (request.isLast()) {
                transferStatus.outputStream().close();
                File source = new File(shard.blobContainer().getBaseDirectory(),
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

            String tmpPath = request.path() + "." + request.transferId();
            FileOutputStream outputStream = new FileOutputStream(
                new File(shard.blobContainer().getBaseDirectory(), tmpPath)
            );

            BytesReference content = request.content();
            if (!content.hasArray()) {
                content = content.toBytesArray();
            }
            outputStream.write(content.array(), content.arrayOffset(), content.length());

            if (request.size() == request.content().length()) {  // start request contains the whole file.
                outputStream.close();
                File source = new File(shard.blobContainer().getBaseDirectory(), tmpPath);
                File target = new File(shard.blobContainer().getBaseDirectory(), request.path());
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

                    resp.headers().add(headerEntry.getKey(), headerValue);
                }
            }
        }

        BytesReference content = response.content();
        ChannelBuffer buffer;
        boolean addedReleaseListener = false;
        try {
            if (response.contentThreadSafe()) {
                buffer = content.toChannelBuffer();
            } else {
                buffer = content.copyBytesArray().toChannelBuffer();
            }
            // handle JSONP
            String callback = request.param("callback");
            if (callback != null) {
                final BytesRef callbackBytes = new BytesRef(callback.length() * 4 + 1);
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

        exportFields.hit(searchHit);
        BytesStreamOutput os = new BytesStreamOutput();
        XContentBuilder builder = new XContentBuilder(XContentFactory.xContent(XContentType.JSON), os);
        exportFields.toXContent(builder, ToXContent.EMPTY_PARAMS);
        builder.flush();
        BytesReference bytes = os.bytes();
        out.write(bytes.array(), bytes.arrayOffset(), bytes.length());
        out.write('\n');
        out.flush();
        numExported++;
    }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

            } 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);
                    }
                }
            }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

            } 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);
                    }
                }
            }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

    @Override
    protected NodeImportResponse nodeOperation(NodeImportRequest request)
            throws ElasticSearchException {
        ImportContext context = new ImportContext(nodePath);

        BytesReference source = request.source();
        importParser.parseSource(context, source);
        Importer.Result result = importer.execute(context, request);
        return new NodeImportResponse(clusterService.state().nodes().localNode(), result);
    }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

    class SourceFieldExtractor extends FieldExtractor {

        @Override
        public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
            BytesReference source = hit.sourceRef();
            XContentType contentType = XContentFactory.xContentType(source);
            XContentParser parser = XContentFactory.xContent(contentType).createParser(source);
            try {
                parser.nextToken();
                builder.field(Fields._SOURCE);
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

            } else {
                String source = request.param("source");
                if (source != null) {
                    searchIntoRequest.source(source);
                } else {
                    BytesReference querySource = RestActions.parseQuerySource(
                            request);
                    if (querySource != null) {
                        searchIntoRequest.source(querySource, false);
                    }
                }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesReference

            shardTarget, indexShard.searcher(), indexService, indexShard, scriptService, cacheRecycler
        );
        SearchIntoContext.setCurrent(context);

        try {
            BytesReference source = request.source();
            parser.parseSource(context, source);
            context.preProcess();
            try {
                if (context.explain()) {
                    return new ShardSearchIntoResponse(
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.