Package org.elasticsearch.action.index

Examples of org.elasticsearch.action.index.IndexResponse


     * @param requestBuilder
     * @return
     */
    public static IndexResponse index(IndexRequestBuilder requestBuilder) {

        IndexResponse indexResponse = requestBuilder.execute().actionGet();

        if (Logger.isDebugEnabled()) {
            Logger.debug("ElasticSearch : Index " + requestBuilder.toString());
        }
        return indexResponse;
View Full Code Here


     * @param indexPath
     * @param indexable
     * @return
     */
    public static IndexResponse index(IndexQueryPath indexPath, String id, Index indexable) {
        IndexResponse indexResponse = getIndexRequestBuilder(indexPath, id, indexable)
                .execute()
                .actionGet();
        if (Logger.isDebugEnabled()) {
            Logger.debug("ElasticSearch : Index : " + indexResponse.getIndex() + "/" + indexResponse.getType() + "/" + indexResponse.getId() + " from " + indexable.toString());
        }
        return indexResponse;
    }
View Full Code Here

                // Issue is fixed on ES 1.1.1
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                type1.location = location;

                // indexing
                IndexResponse index = type1.index();

                // Read
                Index1Type1 typeResult = Index1Type1.find.byId(index.getId());

                assertThat(typeResult).isNotNull();
                assertThat(typeResult.name).isEqualTo(name1);
                assertThat(typeResult.category).isEqualTo(category);
                assertThat(typeResult.dateCreate).isEqualTo(date);
View Full Code Here

                type1.name = name1;
                type1.category = category;
                type1.dateCreate = date;

                // indexing
                IndexResponse index = type1.index();

                // Read
                Index2Type1 typeResult = Index2Type1.find.byId(index.getId());

                assertThat(typeResult).isNotNull();
                assertThat(typeResult.name).isEqualTo(name1);
                assertThat(typeResult.category).isEqualTo(category);
                assertThat(typeResult.dateCreate).isEqualTo(date);
View Full Code Here

        if (!setIndexRequestSource(exchange.getIn(), prepareIndex)) {
            throw new ExpectedBodyTypeException(exchange, XContentBuilder.class);
        }
        ListenableActionFuture<IndexResponse> future = prepareIndex.execute();
        IndexResponse response = future.actionGet();
        exchange.getIn().setBody(response.getId());
    }
View Full Code Here

      Logger.debug("Index Name: %s", indexName);

      contentBuilder = XContentFactory.jsonBuilder().prettyPrint();
      mapper.addModel(model, contentBuilder);
      Logger.debug("Index json: %s", contentBuilder.string());
      IndexResponse response = client.prepareIndex(indexName, typeName, documentId)
          .setSource(contentBuilder).execute().actionGet();

      // Log Debug
      Logger.info("Index Response: %s", response);
View Full Code Here

    String json = document.contentFieldsToJson(document.getContentFields());
    logger.debug("Indexing document " + getDocumentId(document) + " to index " + documentIndex + " with type " + documentType);
    ListenableActionFuture<IndexResponse> actionFuture = client.prepareIndex(documentIndex, documentType, docId)
      .setSource(json)
      .execute();
    IndexResponse response = actionFuture.actionGet(requestTimeout);
    logger.debug("Got response for docId " + response.getId());
  }
View Full Code Here

        byte[] imgToSearch = null;
        String idToSearch = null;
        for (int i = 0; i < totalImages; i ++) {
            byte[] imageByte = getRandomImage();
            String name = randomAsciiOfLength(5);
            IndexResponse response = index(INDEX_NAME, DOC_TYPE_NAME, jsonBuilder().startObject().field("img", imageByte).field("name", name).endObject());
            if (nameToSearch == null || imgToSearch == null || idToSearch == null) {
                nameToSearch = name;
                imgToSearch = imageByte;
                idToSearch = response.getId();
            }
        }

        refresh();
View Full Code Here

                    ((AbstractAttribute) metadata.getIdAttribute()).getBindableJavaType(), values.get(idColumnName));

            ListenableActionFuture<IndexResponse> listenableActionFuture = client
                    .prepareIndex(metadata.getSchema().toLowerCase(), entityClazz.getSimpleName(), id.toString())
                    .setSource(json).execute();
            IndexResponse response = listenableActionFuture.actionGet();
        }
        catch (JsonGenerationException e)
        {
            log.error("Error while creating json document", e);
            throw new KunderaException(e);
View Full Code Here

            addSource(entity, values, entityType);

            addRelations(rlHolders, values);
            addDiscriminator(values, entityType);

            IndexResponse response = txClient
                    .prepareIndex(entityMetadata.getSchema().toLowerCase(), entityMetadata.getTableName(), keyAsString)
                    .setSource(values).execute().actionGet();

            // IndexRequest request = new
            // IndexRequest(entityMetadata.getSchema().toLowerCase(),
            // entityMetadata.getEntityClazz().getSimpleName(), keyAsString);
            // txClient.prepareBulk().add(request)
            assert response.getId() != null;
        }
        finally
        {
            // Nothing as of now.
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.index.IndexResponse

Copyright © 2018 www.massapicom. 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.