当前位置: 首页>>代码示例>>Java>>正文


Java TimeValue.timeValueMinutes方法代码示例

本文整理汇总了Java中org.elasticsearch.common.unit.TimeValue.timeValueMinutes方法的典型用法代码示例。如果您正苦于以下问题:Java TimeValue.timeValueMinutes方法的具体用法?Java TimeValue.timeValueMinutes怎么用?Java TimeValue.timeValueMinutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.unit.TimeValue的用法示例。


在下文中一共展示了TimeValue.timeValueMinutes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteAll

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public void deleteAll() {
    Client client = getConnection().getClient();

    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(QueryBuilders.matchAllQuery())
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();
    do {
       Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToHttpSourceTest)
                .map(HttpSourceTest::getUrl)
                .forEach(this::delete);
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:27,代码来源:EsHttpSourceTestOperations.java

示例2: deleteAll

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public void deleteAll() {
    Client client = getConnection().getClient();

    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(QueryBuilders.matchAllQuery())
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();
    do {
       Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToNamedQuery)
                .forEach(this::delete);
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:26,代码来源:EsNamedQueryOperations.java

示例3: deleteAll

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public void deleteAll() {
    Client client = getConnection().getClient();

    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(QueryBuilders.matchAllQuery())
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();
    do {
       Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToHttpSource)
                .map(HttpSource::getUrl)
                .forEach(this::delete);
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:27,代码来源:EsHttpSourceOperations.java

示例4: getTimeValue

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
/**
 * Returns TimeValue based on the given interval
 * Interval can be in minutes, seconds, mili seconds
 */
public static TimeValue getTimeValue(String interval, String defaultValue) {
    TimeValue timeValue = null;
    String timeInterval = interval != null ? interval : defaultValue;
    logger.trace("Time interval is [{}] ", timeInterval);
    if (timeInterval != null) {
        Integer time = Integer.valueOf(timeInterval.substring(0, timeInterval.length() - 1));
        String unit = timeInterval.substring(timeInterval.length() - 1);
        UnitEnum unitEnum = UnitEnum.fromString(unit);
        switch (unitEnum) {
            case MINUTE:
                timeValue = TimeValue.timeValueMinutes(time);
                break;
            case SECOND:
                timeValue = TimeValue.timeValueSeconds(time);
                break;
            case MILI_SECOND:
                timeValue = TimeValue.timeValueMillis(time);
                break;
            default:
                logger.error("Unit is incorrect, please check the Time Value unit: " + unit);
        }
    }
    return timeValue;
}
 
开发者ID:cognitree,项目名称:flume-elasticsearch-sink,代码行数:29,代码来源:Util.java

示例5: all

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public List<NamedQuery> all() {
    Client client = getConnection().getClient();
    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setQuery(QueryBuilders.matchAllQuery())
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();

    List<NamedQuery> result = Lists.newArrayList();
    do {
        result.addAll(Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToNamedQuery)
                .collect(Collectors.toList()));
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
    return result;
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:28,代码来源:EsNamedQueryOperations.java

示例6: all

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public List<HttpSourceTest> all() {
    BoolQueryBuilder filter = QueryBuilders.boolQuery()
            .must(QueryBuilders.existsQuery("source_url"));


    Client client = getConnection().getClient();
    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(filter)
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();

    List<HttpSourceTest> result = Lists.newArrayList();
    do {
        result.addAll(Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToHttpSourceTest)
                .collect(Collectors.toList()));
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
    return result;
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:32,代码来源:EsHttpSourceTestOperations.java

示例7: all

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
public List<HttpSource> all() {
    BoolQueryBuilder filter = QueryBuilders.boolQuery()
            .must(QueryBuilders.existsQuery("url"))
            .must(QueryBuilders.existsQuery("name"));


    Client client = getConnection().getClient();
    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(filter)
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();

    List<HttpSource> result = Lists.newArrayList();
    do {
        result.addAll(Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToHttpSource)
                .collect(Collectors.toList()));
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
    return result;
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:33,代码来源:EsHttpSourceOperations.java

示例8: expectedTimeToHeal

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
@Override
public TimeValue expectedTimeToHeal() {
    return TimeValue.timeValueMinutes(0);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:BlockClusterStateProcessing.java

示例9: setupListeners

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
@Before
public void setupListeners() throws Exception {
    // Setup dependencies of the listeners
    maxListeners = randomIntBetween(1, 1000);
    listeners = new RefreshListeners(
            () -> maxListeners,
            () -> engine.refresh("too-many-listeners"),
            // Immediately run listeners rather than adding them to the listener thread pool like IndexShard does to simplify the test.
            Runnable::run,
            logger
            );

    // Now setup the InternalEngine which is much more complicated because we aren't mocking anything
    threadPool = new TestThreadPool(getTestName());
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("index", Settings.EMPTY);
    ShardId shardId = new ShardId(new Index("index", "_na_"), 1);
    Directory directory = newDirectory();
    DirectoryService directoryService = new DirectoryService(shardId, indexSettings) {
        @Override
        public Directory newDirectory() throws IOException {
            return directory;
        }
    };
    store = new Store(shardId, indexSettings, directoryService, new DummyShardLock(shardId));
    IndexWriterConfig iwc = newIndexWriterConfig();
    TranslogConfig translogConfig = new TranslogConfig(shardId, createTempDir("translog"), indexSettings,
            BigArrays.NON_RECYCLING_INSTANCE);
    Engine.EventListener eventListener = new Engine.EventListener() {
        @Override
        public void onFailedEngine(String reason, @Nullable Exception e) {
            // we don't need to notify anybody in this test
        }
    };
    TranslogHandler translogHandler = new TranslogHandler(xContentRegistry(), shardId.getIndexName(), logger);
    EngineConfig config = new EngineConfig(EngineConfig.OpenMode.CREATE_INDEX_AND_TRANSLOG, shardId, threadPool, indexSettings, null,
            store, new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy()), newMergePolicy(), iwc.getAnalyzer(),
            iwc.getSimilarity(), new CodecService(null, logger), eventListener, translogHandler,
            IndexSearcher.getDefaultQueryCache(), IndexSearcher.getDefaultQueryCachingPolicy(), translogConfig,
            TimeValue.timeValueMinutes(5), listeners, IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP);
    engine = new InternalEngine(config);
    listeners.setTranslog(engine.getTranslog());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:RefreshListenersTests.java

示例10: defaultValue

import org.elasticsearch.common.unit.TimeValue; //导入方法依赖的package包/类
@Override
public TimeValue defaultValue() {
    return TimeValue.timeValueMinutes(30);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:CrateTableSettings.java


注:本文中的org.elasticsearch.common.unit.TimeValue.timeValueMinutes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。