Package org.elasticsearch.action.get

Examples of org.elasticsearch.action.get.GetResponse


      throw new IllegalStateException("Jira River must be stopped to reconfigure it!");

    logger.info("reconfiguring JIRA River");
    String riverIndexName = getRiverIndexName();
    refreshSearchIndex(riverIndexName);
    GetResponse resp = client.prepareGet(riverIndexName, riverName().name(), "_meta").execute().actionGet();
    if (resp.isExists()) {
      if (logger.isDebugEnabled()) {
        logger.debug("Configuration document: {}", resp.getSourceAsString());
      }
      Map<String, Object> newset = resp.getSource();
      configure(newset);
    } else {
      throw new IllegalStateException("Configuration document not found to reconfigure jira river "
          + riverName().name());
    }
View Full Code Here


    if (logger.isDebugEnabled())
      logger.debug("Going to read datetime value from {} property for project {}. Document name is {}.", propertyName,
          projectKey, documentName);

    refreshSearchIndex(getRiverIndexName());
    GetResponse lastSeqGetResponse = client.prepareGet(getRiverIndexName(), riverName.name(), documentName).execute()
        .actionGet();
    if (lastSeqGetResponse.isExists()) {
      Object timestamp = lastSeqGetResponse.getSourceAsMap().get(STORE_FIELD_VALUE);
      if (timestamp != null) {
        lastDate = DateTimeUtils.parseISODateTime(timestamp.toString());
      }
    } else {
      if (logger.isDebugEnabled())
View Full Code Here

                                // Let's define the rule for UUID generation
                                String id = UUID.nameUUIDFromBytes(description.getBytes()).toString();

                                // Let's look if object already exists
                                GetResponse oldMessage = client.prepareGet(indexName, typeName, id).execute().actionGet();
                                if (!oldMessage.isExists()) {
                                    bulkProcessor.add(indexRequest(indexName).type(typeName).id(id).source(toJson(message, riverName.getName(), feedname, raw)));

                                    if (logger.isDebugEnabled()) logger.debug("FeedMessage update detected for source [{}]", feedname != null ? feedname : "undefined");
                                    if (logger.isTraceEnabled()) logger.trace("FeedMessage is : {}", message);
                                } else {
View Full Code Here

    private Date getLastDateFromRiver(String lastupdateField) {
            Date lastDate = null;
            try {
                // Do something
                client.admin().indices().prepareRefresh("_river").execute().actionGet();
                GetResponse lastSeqGetResponse =
                        client.prepareGet("_river", riverName().name(), lastupdateField).execute().actionGet();
                if (lastSeqGetResponse.isExists()) {
                    Map<String, Object> rssState = (Map<String, Object>) lastSeqGetResponse.getSourceAsMap().get("rss");

                    if (rssState != null) {
                        Object lastupdate = rssState.get(lastupdateField);
                        if (lastupdate != null) {
                            String strLastDate = lastupdate.toString();
View Full Code Here

  }

  public BytesReference getXContentSecurityConfigurationAsBR(
      final String type, final String id)
          throws MalformedConfigurationException {
    final GetResponse resp = client
        .prepareGet(securityConfigurationIndex, type, id)
        .setRefresh(true).setOperationThreaded(false).get();

    if (resp.isExists()) {
      return resp.getSourceAsBytesRef();
    } else {
      throw new MalformedConfigurationException("document type " + type
          + " with id " + id + " does not exists");
    }
  }
View Full Code Here

      log.debug("dls tokens: " + dlsTokens);

      final String id = SecurityUtil.getId(request);

      try {
        final GetResponse res = securityService
            .getClient()
            .get(new GetRequest(SecurityUtil.getIndices(request)
                .get(0), SecurityUtil.getTypes(request).get(0),
                id)).actionGet();

        log.debug("document with id found: " + res.getId());

        final List<DlsPermission> perms = securityService
            .parseDlsPermissions(res.getSourceAsBytesRef());

        log.debug("perms " + perms);

        final List<String> fields = new ArrayList<String>();
View Full Code Here

        }
    }

    protected boolean exists(final String sessionId, final String url) {
        final String id = getId(sessionId, url);
        final GetResponse response = riverConfig.getClient()
                .prepareGet(index, type, id).setRefresh(true).execute()
                .actionGet();
        return response.isExists();
    }
View Full Code Here

    }

    protected <T> T get(final Class<T> clazz, final String sessionId,
            final String url) {
        final String id = getId(sessionId, url);
        final GetResponse response = riverConfig.getClient()
                .prepareGet(index, type, id).execute().actionGet();
        if (response.isExists()) {
            return Beans.createAndCopy(clazz, response.getSource())
                    .converter(new EsTimestampConverter(), timestampFields)
                    .excludesWhitespace().execute();
        }
        return null;
    }
View Full Code Here

        // todo add first-level caching and cycle ref checking
        String indexName = elasticSearchContextHolder.getMappingContext(domainClass).getIndexName();
        String name = elasticSearchContextHolder.getMappingContext(domainClass).getElasticTypeName();
        // A property value is expected to be a map in the form [id:ident]
        Object id = data.get("id");
        GetResponse response = elasticSearchClient.get(new GetRequest(indexName)
                .operationThreaded(false)
                .type(name)
                .id(typeConverter.convertIfNecessary(id, String.class)))
                .actionGet();
        return unmarshallDomain(domainClass, response.getId(), response.getSourceAsMap(), unmarshallingContext);
    }
View Full Code Here

    public void flushCheckpoint() throws IOException {
        flushBulk(null);
    }

    public Long checkpointedAt(String id) throws IOException {
        GetResponse response = client.prepareGet(pubSubIndexName, TYPE, id)
                .setFields("timestamp")
                .execute().actionGet();
        boolean failed = !response.isExists();
        if (failed) {
            logger.warn("can't get checkpoint for {}", id);
            return null;
        } else {
            return (Long) response.getFields().get("timestamp").getValue();
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.get.GetResponse

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.