Package at.molindo.esi4j.mapping

Examples of at.molindo.esi4j.mapping.TypeMapping


      @Override
      public ListenableActionFuture<BulkResponse> execute(Client client, String indexName, OperationContext helper) {
        BulkRequestBuilder request = client.prepareBulk();

        for (Object o : iterable) {
          TypeMapping mapping = helper.findTypeMapping(o);
          IndexRequestBuilder index = mapping.indexRequest(client, indexName, o);
          if (index != null) {
            request.add(index);
          }
        }
View Full Code Here


    index.execute(new Esi4JOperation<Void>() {

      @Override
      public Void execute(Client client, String indexName, Esi4JOperation.OperationContext context) {

        final TypeMapping mapping = context.findTypeMapping(rebuildSession.getType());

        ModuleIdAndVersionStream moduleStream = new ModuleIdAndVersionStream(rebuildSession,
            DEFAULT_BATCH_SIZE, mapping);

        IdAndVersionFactory factory = new MappedObjectIdAndVersionFactory(mapping);

        ElasticSearchSorter elasticSearchSorter = new ElasticSearchSorter(createSorter(factory));
        IteratorFactory iteratorFactory = new IteratorFactory(factory);
        String workingDirectory = SystemUtils.getJavaIoTmpDir().getAbsolutePath();

        ElasticSearchIdAndVersionStream esStream = new ElasticSearchIdAndVersionStream(
            new ElasticSearchDownloader(client, indexName, "_type:" + mapping.getTypeAlias(), factory),
            elasticSearchSorter, iteratorFactory, workingDirectory);

        BulkIndexHelper bulkHelper = new BulkIndexHelper().setMaxRunning(2);
        bulkHelper.setResponseHandler(new BulkIndexHelper.IResponseHandler() {

          @Override
          public void handle(String id, String type) {
            if ("delete".equals(type)) {
              onDelete(mapping.getTypeClass(), mapping.toId(id));
            } else {
              onIndex(mapping.getTypeClass(), mapping.toId(id));
            }
          }

        });
View Full Code Here

      _object = object;
    }

    @Override
    public ListenableActionFuture<IndexResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_object);

      IndexRequestBuilder request = typeMapping.indexRequest(client, indexName, _object);
      if (request == null) {
        throw new Esi4JObjectFilteredException(typeMapping, _object);
      } else {
        return request.execute();
      }
View Full Code Here

      _id = id;
    }

    @Override
    public ListenableActionFuture<GetResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_type);

      final String type = typeMapping.getTypeAlias();
      final String id = typeMapping.toIdString(_id);

      return client.prepareGet(indexName, type, id).execute();
    }
View Full Code Here

    }

    @Override
    @SuppressWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "_id not null at this point")
    public ListenableActionFuture<DeleteResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_type);
      return typeMapping.deleteRequest(client, indexName, typeMapping.toIdString(_id), null).execute();
    }
View Full Code Here

      _size = size;
    }

    @Override
    public ListenableActionFuture<SearchResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_type);

      final String type = typeMapping.getTypeAlias();

      SearchRequestBuilder builder = client.prepareSearch(indexName).setTypes(type).setQuery(_query)
          .setFrom(_from).setSize(_size);

      return builder.execute();
View Full Code Here

      _type = type;
    }

    @Override
    public ListenableActionFuture<CountResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_type);

      final String type = typeMapping.getTypeAlias();

      CountRequestBuilder builder = client.prepareCount(indexName).setTypes(type).setQuery(_query);

      return builder.execute();
    }
View Full Code Here

      _ids = ids;
    }

    @Override
    public ListenableActionFuture<MultiGetResponse> execute(Client client, String indexName, OperationContext helper) {
      final TypeMapping typeMapping = helper.findTypeMapping(_type);
      final String type = typeMapping.getTypeAlias();

      MultiGetRequestBuilder builder = client.prepareMultiGet();
      for (Object id : _ids) {
        // ignore indexName as it may be a multi-index
        builder.add(helper.findIndexName(_type), type, typeMapping.toIdString(id));
      }

      return builder.execute();
    }
View Full Code Here

    index.execute(new Esi4JOperation<Void>() {

      @Override
      public Void execute(Client client, String indexName, Esi4JOperation.OperationContext context) {
        TypeMapping mapping = context.findTypeMapping(type);
        client.admin().indices().prepareDeleteMapping(indexName).setType(mapping.getTypeAlias()).execute()
            .actionGet();
        return null;
      }
    });
View Full Code Here

      add(toIndexRequest(o));
      return this;
    }

    public IndexRequestBuilder toIndexRequest(Object object) {
      TypeMapping mapping = _context.findTypeMapping(object);
      return mapping.indexRequest(_client, _indexName, object);
    }
View Full Code Here

TOP

Related Classes of at.molindo.esi4j.mapping.TypeMapping

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.