Package org.elasticsearch.cluster

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


                        // only the master controls the version numbers
                        Builder builder = ClusterState.builder().state(clusterState).version(clusterState.version() + 1);
                        if (previousClusterState.routingTable() != clusterState.routingTable()) {
                            builder.routingTable(RoutingTable.builder().routingTable(clusterState.routingTable()).version(clusterState.routingTable().version() + 1));
                        }
                        if (previousClusterState.metaData() != clusterState.metaData()) {
                            builder.metaData(MetaData.builder().metaData(clusterState.metaData()).version(clusterState.metaData().version() + 1));
                        }
                        clusterState = builder.build();
                    } else {
                        // we got this cluster state from the master, filter out based on versions (don't call listeners)
View Full Code Here


        }
    }

    private void innerExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
        ClusterState clusterState = clusterService.state();
        request.routing(clusterState.metaData().resolveIndexRouting(request.routing(), request.index()));
        request.index(clusterState.metaData().concreteIndex(request.index())); // we need to get the concrete index here...
        if (clusterState.metaData().hasIndex(request.index())) {
            // check if routing is required, if so, do a broadcast delete
            MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mapping(request.type());
            if (mappingMd != null && mappingMd.routing().required()) {
View Full Code Here

    }

    private void innerExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
        ClusterState clusterState = clusterService.state();
        request.routing(clusterState.metaData().resolveIndexRouting(request.routing(), request.index()));
        request.index(clusterState.metaData().concreteIndex(request.index())); // we need to get the concrete index here...
        if (clusterState.metaData().hasIndex(request.index())) {
            // check if routing is required, if so, do a broadcast delete
            MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mapping(request.type());
            if (mappingMd != null && mappingMd.routing().required()) {
                if (request.routing() == null) {
View Full Code Here

    private void innerExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
        ClusterState clusterState = clusterService.state();
        request.routing(clusterState.metaData().resolveIndexRouting(request.routing(), request.index()));
        request.index(clusterState.metaData().concreteIndex(request.index())); // we need to get the concrete index here...
        if (clusterState.metaData().hasIndex(request.index())) {
            // check if routing is required, if so, do a broadcast delete
            MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mapping(request.type());
            if (mappingMd != null && mappingMd.routing().required()) {
                if (request.routing() == null) {
                    indexDeleteAction.execute(new IndexDeleteRequest(request), new ActionListener<IndexDeleteResponse>() {
View Full Code Here

        ClusterState clusterState = clusterService.state();
        request.routing(clusterState.metaData().resolveIndexRouting(request.routing(), request.index()));
        request.index(clusterState.metaData().concreteIndex(request.index())); // we need to get the concrete index here...
        if (clusterState.metaData().hasIndex(request.index())) {
            // check if routing is required, if so, do a broadcast delete
            MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mapping(request.type());
            if (mappingMd != null && mappingMd.routing().required()) {
                if (request.routing() == null) {
                    indexDeleteAction.execute(new IndexDeleteRequest(request), new ActionListener<IndexDeleteResponse>() {
                        @Override public void onResponse(IndexDeleteResponse indexDeleteResponse) {
                            // go over the response, see if we have found one, and the version if found
View Full Code Here

    @Override protected void doExecute(final MultiGetRequest request, final ActionListener<MultiGetResponse> listener) {
        ClusterState clusterState = clusterService.state();
        Map<ShardId, MultiGetShardRequest> shardRequests = new HashMap<ShardId, MultiGetShardRequest>();
        for (int i = 0; i < request.items.size(); i++) {
            MultiGetRequest.Item item = request.items.get(i);
            item.index(clusterState.metaData().concreteIndex(item.index()));
            ShardId shardId = clusterService.operationRouting()
                    .getShards(clusterState, item.index(), item.type(), item.id(), item.routing(), null).shardId();
            MultiGetShardRequest shardRequest = shardRequests.get(shardId);
            if (shardRequest == null) {
                shardRequest = new MultiGetShardRequest(shardId.index().name(), shardId.id());
View Full Code Here

    @Override protected void doExecute(final MoreLikeThisRequest request, final ActionListener<SearchResponse> listener) {
        // update to actual index name
        ClusterState clusterState = clusterService.state();
        // update to the concrete index
        final String concreteIndex = clusterState.metaData().concreteIndex(request.index());

        Set<String> getFields = newHashSet();
        if (request.fields() != null) {
            Collections.addAll(getFields, request.fields());
        }
View Full Code Here

    @Override protected void doExecute(SearchRequest searchRequest, ActionListener<SearchResponse> listener) {
        // optimize search type for cases where there is only one shard group to search on
        if (optimizeSingleShard && searchRequest.searchType() != SCAN && searchRequest.searchType() != COUNT) {
            try {
                ClusterState clusterState = clusterService.state();
                String[] concreteIndices = clusterState.metaData().concreteIndices(searchRequest.indices(), false, true);
                Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(searchRequest.routing(), searchRequest.indices());
                int shardCount = clusterService.operationRouting().searchShardsCount(clusterState, searchRequest.indices(), concreteIndices, searchRequest.queryHint(), routingMap, searchRequest.preference());
                if (shardCount == 1) {
                    // if we only have one group, then we always want Q_A_F, no need for DFS, and no need to do THEN since we hit one shard
                    searchRequest.searchType(QUERY_AND_FETCH);
View Full Code Here

        // optimize search type for cases where there is only one shard group to search on
        if (optimizeSingleShard && searchRequest.searchType() != SCAN && searchRequest.searchType() != COUNT) {
            try {
                ClusterState clusterState = clusterService.state();
                String[] concreteIndices = clusterState.metaData().concreteIndices(searchRequest.indices(), false, true);
                Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(searchRequest.routing(), searchRequest.indices());
                int shardCount = clusterService.operationRouting().searchShardsCount(clusterState, searchRequest.indices(), concreteIndices, searchRequest.queryHint(), routingMap, searchRequest.preference());
                if (shardCount == 1) {
                    // if we only have one group, then we always want Q_A_F, no need for DFS, and no need to do THEN since we hit one shard
                    searchRequest.searchType(QUERY_AND_FETCH);
                }
View Full Code Here

            this.request = request;
            this.listener = listener;

            // update to the concrete index
            ClusterState clusterState = clusterService.state();
            request.index(clusterState.metaData().concreteIndex(request.index()));

            checkBlock(request, clusterState);

            if (request.replicationType() != ReplicationType.DEFAULT) {
                replicationType = request.replicationType();
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.