Examples of index()


Examples of org.elasticsearch.action.admin.indices.status.IndicesStatusResponse.index()

        client.client().admin().indices().prepareRefresh().execute().actionGet();

        // check the status
        IndicesStatusResponse status = client.client().admin().indices().prepareStatus("test").execute().actionGet();
        for (IndexShardStatus shardStatus : status.index("test")) {
            ShardStatus shard = shardStatus.shards()[0];
            logger.info("shard [{}], docs [{}]", shard.shardId(), shard.getDocs().numDocs());
            for (ShardStatus shardStatu : shardStatus) {
                if (shard.docs().numDocs() != shardStatu.docs().numDocs()) {
                    logger.warn("shard doc number does not match!, got {} and {}", shard.docs().numDocs(), shardStatu.docs().numDocs());
View Full Code Here

Examples of org.elasticsearch.action.delete.DeleteRequest.index()

                    // update the request with teh version so it will go to the replicas
                    deleteRequest.version(delete.version());

                    // add the response
                    responses[i] = new BulkItemResponse(item.id(), "delete",
                            new DeleteResponse(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), delete.version(), delete.notFound()));
                } catch (Exception e) {
                    logger.debug("[{}][{}] failed to bulk item (delete) {}", e, shardRequest.request.index(), shardRequest.shardId, deleteRequest);
                    responses[i] = new BulkItemResponse(item.id(), "delete",
                            new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), ExceptionsHelper.detailedMessage(e)));
                }
View Full Code Here

Examples of org.elasticsearch.action.delete.DeleteResponse.index()

            assertThat(getResult.exists(), equalTo(false));
        }

        logger.info("Delete [type1/1]");
        DeleteResponse deleteResponse = client1.prepareDelete("test", "type1", "1").setReplicationType(ReplicationType.SYNC).execute().actionGet();
        assertThat(deleteResponse.index(), equalTo(getConcreteIndexName()));
        assertThat(deleteResponse.id(), equalTo("1"));
        assertThat(deleteResponse.type(), equalTo("type1"));
        logger.info("Refreshing");
        client1.admin().indices().refresh(refreshRequest("test")).actionGet();
View Full Code Here

Examples of org.elasticsearch.action.deletebyquery.DeleteByQueryResponse.index()

            assertThat(countResponse.failedShards(), equalTo(5));
        }

        logger.info("Delete by query");
        DeleteByQueryResponse queryResponse = client2.prepareDeleteByQuery().setIndices("test").setQuery(termQuery("name", "test2")).execute().actionGet();
        assertThat(queryResponse.index(getConcreteIndexName()).successfulShards(), equalTo(5));
        assertThat(queryResponse.index(getConcreteIndexName()).failedShards(), equalTo(0));
        client1.admin().indices().refresh(refreshRequest("test")).actionGet();

        logger.info("Get [type1/1] and [type1/2], should be empty");
        for (int i = 0; i < 5; i++) {
View Full Code Here

Examples of org.elasticsearch.action.explain.ExplainRequest.index()

        client.explain(explainRequest, new RestBuilderListener<ExplainResponse>(channel) {
            @Override
            public RestResponse buildResponse(ExplainResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                //null checks for bw comp, since we only added in 1.4 index, type and id to ExplainResponse
                builder.field(Fields._INDEX, response.getIndex() != null ? response.getIndex() : explainRequest.index())
                        .field(Fields._TYPE, response.getType() != null ? response.getType() : explainRequest.type())
                        .field(Fields._ID, response.getId() != null ? response.getId() : explainRequest.id())
                        .field(Fields.MATCHED, response.isMatch());

                if (response.hasExplanation()) {
View Full Code Here

Examples of org.elasticsearch.action.get.GetRequest.index()

                    header.put("id", entry.getValue());
                } else if ("index".equals(entry.getKey()) || "indices".equals(entry.getKey())) {
                    if (!allowExplicitIndex) {
                        throw new ElasticsearchIllegalArgumentException("explicit index in multi percolate is not allowed");
                    }
                    getRequest.index((String) value);
                } else if ("type".equals(entry.getKey())) {
                    getRequest.type((String) value);
                } else if ("preference".equals(entry.getKey())) {
                    getRequest.preference((String) value);
                } else if ("routing".equals(entry.getKey())) {
View Full Code Here

Examples of org.elasticsearch.action.get.GetResponse.index()

        GetResponse getResult;

        logger.info("Get [type1/1]");
        for (int i = 0; i < 5; i++) {
            getResult = client1.prepareGet("test", "type1", "1").setOperationThreaded(false).execute().actionGet();
            assertThat(getResult.index(), equalTo(getConcreteIndexName()));
            assertThat("cycle #" + i, getResult.sourceAsString(), equalTo(source("1", "test").string()));
            assertThat("cycle(map) #" + i, (String) ((Map) getResult.sourceAsMap().get("type1")).get("name"), equalTo("test"));
            getResult = client1.get(getRequest("test").type("type1").id("1").operationThreaded(true)).actionGet();
            assertThat("cycle #" + i, getResult.sourceAsString(), equalTo(source("1", "test").string()));
            assertThat(getResult.index(), equalTo(getConcreteIndexName()));
View Full Code Here

Examples of org.elasticsearch.action.get.MultiGetRequest.Item.index()

    public boolean matches(Object item) {
      if (expected == item) return true;
      if (item == null) return false;
      if (expected.getClass() != item.getClass()) return false;
      Item other = (Item) item;
      return expected.index().equals(other.index())
          && expected.type().equals(other.type())
          && expected.id().equals(other.id())
          && Arrays.equals(expected.fields(), other.fields());
    }
View Full Code Here

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

                    // validate, if routing is required, that we got routing
                    MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mapping(indexRequest.type());
                    if (mappingMd != null && mappingMd.routing().required()) {
                        if (indexRequest.routing() == null) {
                            throw new RoutingMissingException(indexRequest.index(), indexRequest.type(), indexRequest.id());
                        }
                    }

                    SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id())
                            .routing(indexRequest.routing()).parent(indexRequest.parent());
View Full Code Here

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

        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        logger.info("Indexing [type1/1]");
        IndexResponse indexResponse = client1.prepareIndex().setIndex("test").setType("type1").setId("1").setSource(source("1", "test")).setRefresh(true).execute().actionGet();
        assertThat(indexResponse.index(), equalTo(getConcreteIndexName()));
        assertThat(indexResponse.id(), equalTo("1"));
        assertThat(indexResponse.type(), equalTo("type1"));
        logger.info("Refreshing");
        RefreshResponse refreshResponse = client1.admin().indices().prepareRefresh("test").execute().actionGet();
        assertThat(refreshResponse.successfulShards(), equalTo(10));
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.