Examples of unsafeByteArray()


Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

    public ParsedQuery parse(QueryBuilder queryBuilder) throws ElasticSearchException {
        XContentParser parser = null;
        try {
            BytesStream unsafeBytes = queryBuilder.buildAsUnsafeBytes();
            parser = XContentFactory.xContent(unsafeBytes.unsafeByteArray(), 0, unsafeBytes.size()).createParser(unsafeBytes.unsafeByteArray(), 0, unsafeBytes.size());
            return parse(cache.get(), parser);
        } catch (QueryParsingException e) {
            throw e;
        } catch (Exception e) {
            throw new QueryParsingException(index, "Failed to parse", e);
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

    public ParsedQuery parse(QueryBuilder queryBuilder) throws ElasticSearchException {
        XContentParser parser = null;
        try {
            BytesStream unsafeBytes = queryBuilder.buildAsUnsafeBytes();
            parser = XContentFactory.xContent(unsafeBytes.unsafeByteArray(), 0, unsafeBytes.size()).createParser(unsafeBytes.unsafeByteArray(), 0, unsafeBytes.size());
            return parse(cache.get(), parser);
        } catch (QueryParsingException e) {
            throw e;
        } catch (Exception e) {
            throw new QueryParsingException(index, "Failed to parse", e);
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

    public void addQuery(String name, QueryBuilder queryBuilder) throws ElasticSearchException {
        try {
            XContentBuilder builder = XContentFactory.smileBuilder()
                    .startObject().field("query", queryBuilder).endObject();
            BytesStream unsafeBytes = builder.unsafeStream();
            addQuery(name, unsafeBytes.unsafeByteArray(), 0, unsafeBytes.size());
        } catch (IOException e) {
            throw new ElasticSearchException("Failed to add query [" + name + "]", e);
        }
    }
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

     *
     * @see org.elasticsearch.index.query.QueryBuilders
     */
    @Required public DeleteByQueryRequest query(QueryBuilder queryBuilder) {
        BytesStream bos = queryBuilder.buildAsUnsafeBytes();
        this.querySource = bos.unsafeByteArray();
        this.querySourceOffset = 0;
        this.querySourceLength = bos.size();
        this.querySourceUnsafe = true;
        return this;
    }
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

     *
     * @see org.elasticsearch.index.query.QueryBuilders
     */
    @Required public CountRequest query(QueryBuilder queryBuilder) {
        BytesStream bos = queryBuilder.buildAsUnsafeBytes();
        this.querySource = bos.unsafeByteArray();
        this.querySourceOffset = 0;
        this.querySourceLength = bos.size();
        this.querySourceUnsafe = true;
        return this;
    }
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

     * An optional search source request allowing to control the search request for the
     * more like this documents.
     */
    public MoreLikeThisRequest searchSource(SearchSourceBuilder sourceBuilder) {
        BytesStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
        this.searchSource = bos.unsafeByteArray();
        this.searchSourceOffset = 0;
        this.searchSourceLength = bos.size();
        this.searchSourceUnsafe = true;
        return this;
    }
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

    /**
     * The source of the search request.
     */
    public SearchRequest source(SearchSourceBuilder sourceBuilder) {
        BytesStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
        this.source = bos.unsafeByteArray();
        this.sourceOffset = 0;
        this.sourceLength = bos.size();
        this.sourceUnsafe = true;
        return this;
    }
View Full Code Here

Examples of org.elasticsearch.common.io.BytesStream.unsafeByteArray()

    /**
     * Allows to provide additional source that will be used as well.
     */
    public SearchRequest extraSource(SearchSourceBuilder sourceBuilder) {
        BytesStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
        this.extraSource = bos.unsafeByteArray();
        this.extraSourceOffset = 0;
        this.extraSourceLength = bos.size();
        this.extraSourceUnsafe = true;
        return this;
    }
View Full Code Here

Examples of org.elasticsearch.common.io.FastByteArrayOutputStream.unsafeByteArray()

            XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON, os);
            builder.startObject();
            MetaData.Builder.toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
            builder.endObject();
            builder.close();
            metaDataBlobContainer.writeBlob(newMetaData, new ByteArrayInputStream(out.unsafeByteArray(), 0, out.size()), out.size());
        } catch (IOException e) {
            throw new GatewayException("Failed to write metadata [" + newMetaData + "]", e);
        }

        currentIndex++;
View Full Code Here

Examples of org.elasticsearch.common.io.FastByteArrayOutputStream.unsafeByteArray()

            if (!status.clean) {
                if (state == IndexShardState.CLOSED) {
                    // ignore if closed....
                    return;
                }
                logger.warn("check index [failure]\n{}", new String(os.unsafeByteArray(), 0, os.size()));
                if (throwException) {
                    throw new IndexShardException(shardId, "index check failure");
                }
            } else {
                if (logger.isDebugEnabled()) {
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.