Examples of version()


Examples of org.elasticsearch.action.index.IndexRequest.version()

                    SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id())
                            .routing(indexRequest.routing()).parent(indexRequest.parent());
                    long version;
                    Engine.IndexingOperation op;
                    if (indexRequest.opType() == IndexRequest.OpType.INDEX) {
                        Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.version()).versionType(indexRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY);
                        indexShard.index(index);
                        version = index.version();
                        op = index;
                    } else {
                        Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.version()).versionType(indexRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY);
View Full Code Here

Examples of org.elasticsearch.action.index.IndexResponse.version()

        }
        client.admin().indices().prepareCreate("test").execute().actionGet();
        client.admin().cluster().prepareHealth("test").setWaitForGreenStatus().execute().actionGet();

        IndexResponse indexResponse = client.prepareIndex("test", "type", "1").setSource("field1", "value1_1").setVersion(12).setVersionType(VersionType.EXTERNAL).execute().actionGet();
        assertThat(indexResponse.version(), equalTo(12l));

        indexResponse = client.prepareIndex("test", "type", "1").setSource("field1", "value1_1").setVersion(14).setVersionType(VersionType.EXTERNAL).execute().actionGet();
        assertThat(indexResponse.version(), equalTo(14l));

        try {
View Full Code Here

Examples of org.elasticsearch.action.indexedscripts.delete.DeleteIndexedScriptRequest.version()

    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
        DeleteIndexedScriptRequest deleteIndexedScriptRequest = new DeleteIndexedScriptRequest(getScriptLang(request), request.param("id"));
        deleteIndexedScriptRequest.version(request.paramAsLong("version", deleteIndexedScriptRequest.version()));
        deleteIndexedScriptRequest.versionType(VersionType.fromString(request.param("version_type"), deleteIndexedScriptRequest.versionType()));
        client.deleteIndexedScript(deleteIndexedScriptRequest, new RestBuilderListener<DeleteIndexedScriptResponse>(channel) {
            @Override
            public RestResponse buildResponse(DeleteIndexedScriptResponse result, XContentBuilder builder) throws Exception {
                builder.startObject()
View Full Code Here

Examples of org.elasticsearch.action.indexedscripts.get.GetIndexedScriptRequest.version()


    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
        final GetIndexedScriptRequest getRequest = new GetIndexedScriptRequest(getScriptLang(request), request.param("id"));
        getRequest.version(request.paramAsLong("version", getRequest.version()));
        getRequest.versionType(VersionType.fromString(request.param("version_type"), getRequest.versionType()));
        client.getIndexedScript(getRequest, new RestResponseListener<GetIndexedScriptResponse>(channel) {
            @Override
            public RestResponse buildResponse(GetIndexedScriptResponse response) throws Exception {
                XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
View Full Code Here

Examples of org.elasticsearch.action.indexedscripts.put.PutIndexedScriptRequest.version()

    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
        PutIndexedScriptRequest putRequest = new PutIndexedScriptRequest(getScriptLang(request), request.param("id")).listenerThreaded(false);
        putRequest.version(request.paramAsLong("version", putRequest.version()));
        putRequest.versionType(VersionType.fromString(request.param("version_type"), putRequest.versionType()));
        putRequest.source(request.content(), request.contentUnsafe());
        String sOpType = request.param("op_type");
        if (sOpType != null) {
            try {
View Full Code Here

Examples of org.elasticsearch.action.update.UpdateRequest.version()

        UpdateRequest request = new UpdateRequest(node.indices()[0],
                Constants.DEFAULT_MAPPING_TYPE, node.ids().get(0));
        request.fields(node.columns());
        request.paths(node.updateDoc());
        if (node.version().isPresent()) {
            request.version(node.version().get());
        } else {
            request.retryOnConflict(Constants.UPDATE_RETRY_ON_CONFLICT);
        }
        request.routing(node.routingValues().get(0));
        return request;
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.version()

                masterFD.start(masterNode, "initial_join");

                // we update the metadata once we managed to join, so we pre-create indices and so on (no shards allocation)
                final MetaData metaData = clusterState.metaData();
                // sync also the version with the version the master currently has, so the next update will be applied
                final long version = clusterState.version();
                clusterService.submitStateUpdateTask("zen-disco-join (detected master)", new ProcessedClusterStateUpdateTask() {
                    @Override public ClusterState execute(ClusterState currentState) {
                        ClusterBlocks clusterBlocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(NO_MASTER_BLOCK).build();
                        // make sure we have the local node id set, we might need it as a result of the new metadata
                        DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.newNodesBuilder().putAll(currentState.nodes()).put(localNode).localNodeId(localNode.id());
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.version()

                        } else {
                            // if its not the same version, only copy over new indices or ones that changed the version
                            MetaData.Builder metaDataBuilder = MetaData.builder(updatedState.metaData()).removeAllIndices();
                            for (IndexMetaData indexMetaData : updatedState.metaData()) {
                                IndexMetaData currentIndexMetaData = currentState.metaData().index(indexMetaData.index());
                                if (currentIndexMetaData == null || currentIndexMetaData.version() != indexMetaData.version()) {
                                    metaDataBuilder.put(indexMetaData, false);
                                } else {
                                    metaDataBuilder.put(currentIndexMetaData, false);
                                }
                            }
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.MetaData.version()

                continue;
            }
            found++;
            if (electedGlobalState == null) {
                electedGlobalState = nodeState.metaData();
            } else if (nodeState.metaData().version() > electedGlobalState.version()) {
                electedGlobalState = nodeState.metaData();
            }
            for (ObjectCursor<IndexMetaData> cursor : nodeState.metaData().indices().values()) {
                indices.addTo(cursor.value.index(), 1);
            }
View Full Code Here

Examples of org.elasticsearch.cluster.node.DiscoveryNode.version()

                        logger.warn("node {} not part of the cluster {}, ignoring...", listedNode, clusterName);
                        newFilteredNodes.add(listedNode);
                    } else if (nodeInfo.getNodes().length != 0) {
                        // use discovered information but do keep the original transport address, so people can control which address is exactly used.
                        DiscoveryNode nodeWithInfo = nodeInfo.getNodes()[0].getNode();
                        newNodes.add(new DiscoveryNode(nodeWithInfo.name(), nodeWithInfo.id(), nodeWithInfo.getHostName(), nodeWithInfo.getHostAddress(), listedNode.address(), nodeWithInfo.attributes(), nodeWithInfo.version()));
                    } else {
                        // although we asked for one node, our target may not have completed initialization yet and doesn't have cluster nodes
                        logger.debug("node {} didn't return any discovery info, temporarily using transport discovery node", listedNode);
                        newNodes.add(listedNode);
                    }
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.