private BasicDBObject getFilterForInitialImport(BasicDBObject filter, String id) { Preconditions.checkNotNull(filter); if (id == null) { return filter; } BasicDBObject idFilter = new BasicDBObject(MongoDBRiver.MONGODB_ID_FIELD, new BasicBSONObject(QueryOperators.GT, id)); if (filter.equals(new BasicDBObject())) { return idFilter; } return new BasicDBObject(QueryOperators.AND, ImmutableList.of(filter, idFilter)); }
public List<HashedStringEntry> entries() { if (!(entries instanceof List)) { entries = ImmutableList.copyOf(entries); } return (List<HashedStringEntry>) entries; }
if (transportClient.connectedNodes().isEmpty()) { throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!");
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = entry.getValue().doubleValue(); final double value = Double.parseDouble(entry.getKey()); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentileRanksImpl(name, builder.build()); }
public static InternalAggregations fromXContentUnwrapped(final Map<String, Object> aggregationsMap, final AggregationsManifest aggregationsManifest) { if (aggregationsManifest == null) { checkArgument(aggregationsMap.isEmpty()); return new InternalAggregations(ImmutableList.<InternalAggregation>of()); final ImmutableList.Builder<InternalAggregation> builder = ImmutableList.builder(); for (Map.Entry<String, AggregationManifest> entry : aggregationsManifest.getManifest().entrySet()) { final String name = entry.getKey();
@Override public boolean isConnected() { if (client != null) { return client.connectedNodes().size() != 0; } return false; }
@Override public Iterator<Percentile> iterator() { return percentiles.iterator(); } }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = Double.parseDouble(entry.getKey()); final double value = entry.getValue().doubleValue(); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentilesImpl(name, builder.build()); }
public static InternalAggregations fromXContentUnwrapped(final Map<String, Object> aggregationsMap, final AggregationsManifest aggregationsManifest) { if (aggregationsManifest == null) { checkArgument(aggregationsMap.isEmpty()); return new InternalAggregations(ImmutableList.<InternalAggregation>of()); final ImmutableList.Builder<InternalAggregation> builder = ImmutableList.builder(); for (Map.Entry<String, AggregationManifest> entry : aggregationsManifest.getManifest().entrySet()) { final String name = entry.getKey();
@Override public boolean isConnected() { if (client != null) { return client.connectedNodes().size() != 0; } return false; }
@Override public Iterator<Percentile> iterator() { return percentiles.iterator(); } }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = entry.getValue().doubleValue(); final double value = Double.parseDouble(entry.getKey()); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentileRanksImpl(name, builder.build()); }
public ImmutableList<GeoCluster> build() { return ImmutableList.copyOf(clusters); } }
protected Client createClient() { if (client == null) { if (logger.isDebugEnabled()) { logger.debug("Creating client for Search!"); } // Try starting search client at context loading try { final Settings settings = ImmutableSettings .settingsBuilder() .put(ElasticSearchReservedWords.CLUSTER_NAME.getText(), searchServerClusterName).build(); TransportClient transportClient = new TransportClient(settings); transportClient = transportClient .addTransportAddress(new InetSocketTransportAddress( "localhost", 9300)); if (transportClient.connectedNodes().size() == 0) { logger.error("There are no active nodes available for the transport, it will be automatically added once nodes are live!"); } client = transportClient; } catch (final Exception ex) { // ignore any exception, dont want to stop context loading logger.error("Error occured while creating search client!", ex); } } return client; }
ApproximatePercentileRanksImpl(final String name, final ImmutableList<Percentile> percents) { super(name); this.name = name; checkState(!percents.isEmpty()); TreeMap<Double, Double> map = new TreeMap<Double, Double>(); for (Percentile p : percents) { map.put(p.getValue(), p.getPercent()); } this.map = map; this.percents = percents; }
@Override public Iterator<Percentile> iterator() { return percents.iterator(); } }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = Double.parseDouble(entry.getKey()); final double value = entry.getValue().doubleValue(); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentilesImpl(name, builder.build()); }
@Override public List<GeoCluster> getEntries() { return ImmutableList.copyOf(entries); }