本文整理了Java中org.elasticsearch.common.unit.TimeValue.timeValueSeconds()
方法的一些代码示例,展示了TimeValue.timeValueSeconds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeValue.timeValueSeconds()
方法的具体详情如下:
包路径:org.elasticsearch.common.unit.TimeValue
类名称:TimeValue
方法名:timeValueSeconds
暂无
代码示例来源:origin: floragunncom/search-guard
ClusterInfo cInfo = waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(timeout), nodes == null?esNodes.size():nodes.intValue());
cInfo.numNodes = internalNodeSettings.size();
cInfo.clustername = clustername;
代码示例来源:origin: SonarSource/sonarqube
@Override
public ClusterHealthStatus getClusterHealthStatus() {
return getTransportClient().admin().cluster()
.health(new ClusterHealthRequest().waitForStatus(ClusterHealthStatus.YELLOW).timeout(timeValueSeconds(30)))
.actionGet().getStatus();
}
代码示例来源:origin: brianway/webporter
.setBulkActions(10000)
.setBulkSize(new ByteSizeValue(5, ByteSizeUnit.MB))
.setFlushInterval(TimeValue.timeValueSeconds(5))
.setConcurrentRequests(10)
.setBackoffPolicy(
代码示例来源:origin: floragunncom/search-guard
@Test
public void testCreateIndex() throws Exception {
setup();
RestHelper rh = nonSslRestHelper();
HttpResponse res;
Assert.assertEquals("Unable to create index 'nag'", HttpStatus.SC_OK, rh.executePutRequest("nag1", null, encodeBasicHeader("nagilum", "nagilum")).getStatusCode());
Assert.assertEquals("Unable to create index 'starfleet_library'", HttpStatus.SC_OK, rh.executePutRequest("starfleet_library", null, encodeBasicHeader("nagilum", "nagilum")).getStatusCode());
clusterHelper.waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(10), clusterInfo.numNodes);
Assert.assertEquals("Unable to close index 'starfleet_library'", HttpStatus.SC_OK, rh.executePostRequest("starfleet_library/_close", null, encodeBasicHeader("nagilum", "nagilum")).getStatusCode());
Assert.assertEquals("Unable to open index 'starfleet_library'", HttpStatus.SC_OK, (res = rh.executePostRequest("starfleet_library/_open", null, encodeBasicHeader("nagilum", "nagilum"))).getStatusCode());
Assert.assertTrue("open index 'starfleet_library' not acknowledged", res.getBody().contains("acknowledged"));
Assert.assertFalse("open index 'starfleet_library' not acknowledged", res.getBody().contains("false"));
clusterHelper.waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(10), clusterInfo.numNodes);
Assert.assertEquals(HttpStatus.SC_FORBIDDEN, rh.executePutRequest("public", null, encodeBasicHeader("spock", "spock")).getStatusCode());
}
代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb
updateIndexRefresh(definition.getIndexName(), TimeValue.timeValueSeconds(1));
代码示例来源:origin: komoot/photon
@Override
public SearchResponse search(QueryBuilder queryBuilder, Integer limit) {
TimeValue timeout = TimeValue.timeValueSeconds(7);
return client.prepareSearch("photon").
setSearchType(SearchType.QUERY_AND_FETCH).
setQuery(queryBuilder).
setSize(limit).
setTimeout(timeout).
execute().
actionGet();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
TimeValue.timeValueNanos(avgTaskTime),
TimeValue.timeValueNanos((long)executionEWMA.getAverage()),
String.format(Locale.ROOT, "%.2f", lambda * TimeValue.timeValueSeconds(1).nanos()),
desiredQueueSize,
oldCapacity);
代码示例来源:origin: org.elasticsearch/elasticsearch
final int halfProcMaxAt10 = halfNumberOfProcessorsMaxTen(availableProcessors);
final int genericThreadPoolMax = boundedBy(4 * availableProcessors, 128, 512);
builders.put(Names.GENERIC, new ScalingExecutorBuilder(Names.GENERIC, 4, genericThreadPoolMax, TimeValue.timeValueSeconds(30)));
builders.put(Names.INDEX, new FixedExecutorBuilder(settings, Names.INDEX, availableProcessors, 200, true));
builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, "bulk", availableProcessors, 200));
代码示例来源:origin: komoot/photon
@Override
public SearchResponse search(QueryBuilder queryBuilder, Integer limit, Point location,
Boolean locationDistanceSort) {
TimeValue timeout = TimeValue.timeValueSeconds(7);
SearchRequestBuilder builder = client.prepareSearch("photon").setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(queryBuilder).setSize(limit).setTimeout(timeout);
if (locationDistanceSort)
builder.addSort(SortBuilders.geoDistanceSort("coordinate", new GeoPoint(location.getY(), location.getX()))
.order(SortOrder.ASC));
return builder.execute().actionGet();
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
final String frameSizeKey = settingsKey(prefix, "auto_queue_frame_size");
final String targetedResponseTimeKey = settingsKey(prefix, "target_response_time");
this.targetedResponseTimeSetting = Setting.timeSetting(targetedResponseTimeKey, TimeValue.timeValueSeconds(1),
TimeValue.timeValueMillis(10), Setting.Property.NodeScope);
this.queueSizeSetting = Setting.intSetting(queueSizeKey, initialQueueSize, Setting.Property.NodeScope);
代码示例来源:origin: org.elasticsearch/elasticsearch
membership.sendLeaveRequestBlocking(nodes.getMasterNode(), nodes.getLocalNode(), TimeValue.timeValueSeconds(1));
} catch (Exception e) {
logger.debug(() -> new ParameterizedMessage("failed to send leave request to master [{}]", nodes.getMasterNode()), e);
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Ensures the cluster has a yellow state via the cluster health API.
*/
public ClusterHealthStatus ensureYellow(String... indices) {
return ensureColor(ClusterHealthStatus.YELLOW, TimeValue.timeValueSeconds(30), false, indices);
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Ensures the cluster has a yellow state via the cluster health API and ensures the that cluster has no initializing shards
* for the given indices
*/
public ClusterHealthStatus ensureYellowAndNoInitializingShards(String... indices) {
return ensureColor(ClusterHealthStatus.YELLOW, TimeValue.timeValueSeconds(30), true, indices);
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Ensures the cluster has a green state via the cluster health API. This method will also wait for relocations.
* It is useful to ensure that all action on the cluster have finished and all shards that were currently relocating
* are now allocated and started.
*/
public ClusterHealthStatus ensureGreen(String... indices) {
return ensureGreen(TimeValue.timeValueSeconds(30), indices);
}
代码示例来源:origin: javanna/elasticshell
protected boolean clusterKo(Client client) {
try {
client.admin().cluster().prepareHealth().setTimeout(TimeValue.timeValueSeconds(1)).execute().actionGet();
return false;
} catch(Exception e) {
return true;
}
}
代码示例来源:origin: com.blossom-project/blossom-core-common
@Override
public SearchResult<DTO> search(String q, Pageable pageable, Iterable<QueryBuilder> filters,
Iterable<FacetConfiguration> facetConfigurations) {
SearchRequestBuilder searchRequest = prepareSearch(q, pageable, filters, facetConfigurations);
SearchResponse searchResponse = searchRequest.get(TimeValue.timeValueSeconds(10));
return parseResults(searchResponse, pageable, facetConfigurations);
}
代码示例来源:origin: harbby/presto-connectors
@Inject
public StoreRecoveryService(ShardId shardId, IndexSettingsService indexSettingsService, ThreadPool threadPool,
MappingUpdatedAction mappingUpdatedAction, ClusterService clusterService, RepositoriesService repositoriesService, RestoreService restoreService) {
super(shardId, indexSettingsService.getSettings());
this.threadPool = threadPool;
this.mappingUpdatedAction = mappingUpdatedAction;
this.restoreService = restoreService;
this.repositoriesService = repositoriesService;
this.clusterService = clusterService;
this.waitForMappingUpdatePostRecovery = indexSettings.getAsTime(SETTING_MAPPING_UPDATE_WAIT, indexSettings.getAsTime(SETTING_MAPPING_UPDATE_WAIT_LEGACY, TimeValue.timeValueSeconds(15)));
}
代码示例来源:origin: lt.tokenmill.crawling/elasticsearch
private static ElasticConnection getConnection(String hostname, int transportPort, String flushIntervalString, BulkProcessor.Listener listener) {
System.setProperty("es.set.netty.runtime.available.processors", "false");
TimeValue flushInterval = TimeValue.parseTimeValue(flushIntervalString, TimeValue.timeValueSeconds(5), "flush");
Client client = getClient(hostname, transportPort);
BulkProcessor bulkProcessor = BulkProcessor.builder(client, listener)
.setFlushInterval(flushInterval)
.setBulkActions(10)
.setConcurrentRequests(10)
.build();
return new ElasticConnection(client, bulkProcessor);
}
代码示例来源:origin: harbby/presto-connectors
@Inject
public ProcessService(Settings settings, ProcessProbe probe) {
super(settings);
this.probe = probe;
final TimeValue refreshInterval = settings.getAsTime("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1));
processStatsCache = new ProcessStatsCache(refreshInterval, probe.processStats());
this.info = probe.processInfo();
this.info.refreshInterval = refreshInterval.millis();
logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval);
}
代码示例来源:origin: harbby/presto-connectors
public Store(ShardId shardId, Settings indexSettings, DirectoryService directoryService, ShardLock shardLock, OnClose onClose) throws IOException {
super(shardId, indexSettings);
this.directory = new StoreDirectory(directoryService.newDirectory(), Loggers.getLogger("index.store.deletes", indexSettings, shardId));
this.shardLock = shardLock;
this.onClose = onClose;
final TimeValue refreshInterval = indexSettings.getAsTime(INDEX_STORE_STATS_REFRESH_INTERVAL, TimeValue.timeValueSeconds(10));
this.statsCache = new StoreStatsCache(refreshInterval, directory, directoryService);
logger.debug("store stats are refreshed with refresh_interval [{}]", refreshInterval);
assert onClose != null;
assert shardLock != null;
assert shardLock.getShardId().equals(shardId);
}
内容来源于网络,如有侵权,请联系作者删除!