@Test public void shouldAddNewEventWithoutTTL() throws Exception { fixture.addEvent(event, nameBuilder, "bar_type", -1); verify(indexRequestBuilder).setSource( serializer.getContentBuilder(event).bytes()); verify(bulkRequestBuilder).add(indexRequestBuilder); }
@Override public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception { if (bulkRequestBuilder == null) { bulkRequestBuilder = client.prepareBulk(); } IndexRequestBuilder indexRequestBuilder = null; if (indexRequestBuilderFactory == null) { indexRequestBuilder = client .prepareIndex(indexNameBuilder.getIndexName(event), indexType) .setSource(serializer.getContentBuilder(event).bytes()); } else { indexRequestBuilder = indexRequestBuilderFactory.createIndexRequest( client, indexNameBuilder.getIndexPrefix(event), indexType, event); } if (ttlMs > 0) { indexRequestBuilder.setTTL(ttlMs); } bulkRequestBuilder.add(indexRequestBuilder); }
ElasticSearchTransportClient implements ElasticSearchClient { @Override public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception { if (bulkRequestBuilder == null) { bulkRequestBuilder = client.prepareBulk(); } IndexRequestBuilder indexRequestBuilder = null; if (indexRequestBuilderFactory == null) { indexRequestBuilder = client .prepareIndex(indexNameBuilder.getIndexName(event), indexType) .setSource(serializer.getContentBuilder(event).bytes()); } else { indexRequestBuilder = indexRequestBuilderFactory.createIndexRequest( client, indexNameBuilder.getIndexPrefix(event), indexType, event); } if (ttlMs > 0) { indexRequestBuilder.setTTL(ttlMs); } bulkRequestBuilder.add(indexRequestBuilder); } }
ElasticSearchTransportClient implements ElasticSearchClient { @Override public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception { if (bulkRequestBuilder == null) { bulkRequestBuilder = client.prepareBulk(); } IndexRequestBuilder indexRequestBuilder = null; if (indexRequestBuilderFactory == null) { indexRequestBuilder = client .prepareIndex(indexNameBuilder.getIndexName(event), indexType) .setSource(serializer.getContentBuilder(event).bytes()); } else { indexRequestBuilder = indexRequestBuilderFactory.createIndexRequest( client, indexNameBuilder.getIndexPrefix(event), indexType, event); } if (ttlMs > 0) { indexRequestBuilder.setTTL(ttlMs); } bulkRequestBuilder.add(indexRequestBuilder); } ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchIndexRequestBuilderFactory indexBuilder);  ElasticSearchTransportClient(ElasticSearchIndexRequestBuilderFactory indexBuilderFactory);  ElasticSearchTransportClient(ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
                                      ElasticSearchIndexRequestBuilderFactory requestBuilderFactory); }
ElasticSearchTransportClient implements ElasticSearchClient { @Override public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception { if (bulkRequestBuilder == null) { bulkRequestBuilder = client.prepareBulk(); } IndexRequestBuilder indexRequestBuilder = null; if (indexRequestBuilderFactory == null) { indexRequestBuilder = client .prepareIndex(indexNameBuilder.getIndexName(event), indexType) .setSource(serializer.getContentBuilder(event).bytes()); } else { indexRequestBuilder = indexRequestBuilderFactory.createIndexRequest( client, indexNameBuilder.getIndexPrefix(event), indexType, event); } if (ttlMs > 0) { indexRequestBuilder.setTTL(ttlMs); } bulkRequestBuilder.add(indexRequestBuilder); } ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchIndexRequestBuilderFactory indexBuilder);  ElasticSearchTransportClient(ElasticSearchIndexRequestBuilderFactory indexBuilderFactory);  ElasticSearchTransportClient(ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
                                      ElasticSearchIndexRequestBuilderFactory requestBuilderFactory); @Override void close(); @Override void addEvent(Event event, IndexNameBuilder indexNameBuilder,
      String indexType, long ttlMs); @Override void execute(); @Override void configure(Context context); }
ElasticSearchTransportClient implements ElasticSearchClient { @Override public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception { if (bulkRequestBuilder == null) { bulkRequestBuilder = client.prepareBulk(); } IndexRequestBuilder indexRequestBuilder = null; if (indexRequestBuilderFactory == null) { indexRequestBuilder = client .prepareIndex(indexNameBuilder.getIndexName(event), indexType) .setSource(serializer.getContentBuilder(event).bytes()); } else { indexRequestBuilder = indexRequestBuilderFactory.createIndexRequest( client, indexNameBuilder.getIndexPrefix(event), indexType, event); } if (ttlMs > 0) { indexRequestBuilder.setTTL(ttlMs); } bulkRequestBuilder.add(indexRequestBuilder); } ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(String[] hostNames, String clusterName,
      ElasticSearchIndexRequestBuilderFactory indexBuilder);  ElasticSearchTransportClient(ElasticSearchIndexRequestBuilderFactory indexBuilderFactory);  ElasticSearchTransportClient(ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
      ElasticSearchEventSerializer serializer);  ElasticSearchTransportClient(Client client,
                                      ElasticSearchIndexRequestBuilderFactory requestBuilderFactory); @Override void close(); @Override void addEvent(Event event, IndexNameBuilder indexNameBuilder,
      String indexType, long ttlMs); @Override void execute(); @Override void configure(Context context); static final Logger logger; }