• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectLookupContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.carrotsearch.hppc.ObjectLookupContainer的典型用法代码示例。如果您正苦于以下问题:Java ObjectLookupContainer类的具体用法?Java ObjectLookupContainer怎么用?Java ObjectLookupContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectLookupContainer类属于com.carrotsearch.hppc包,在下文中一共展示了ObjectLookupContainer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getIndexTypeMapping

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
public static Map<String, List<String>> getIndexTypeMapping() {
	Map<String, List<String>> indexTypeMapping = new HashMap<String, List<String>>();
	List<String> typeList = null;

	ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> f = ESReport.getESClient().admin().indices().getMappings(new GetMappingsRequest()).actionGet().getMappings();

	Object[] indexList = f.keys().toArray();
	for (Object indexObj : indexList) {
		String index = indexObj.toString();
		ImmutableOpenMap<String, MappingMetaData> mapping = f.get(index);
		typeList = new ArrayList<String>();
		
		ClusterStateResponse resp = ESReport.getESClient().admin().cluster().prepareState().execute().actionGet();
		ObjectLookupContainer<String> objectLookupContainer = resp.getState().metaData().index(index).getMappings().keys();
		for(ObjectCursor<String> objectCursor:objectLookupContainer){
			typeList.add(objectCursor.value);
		}
		indexTypeMapping.put(index, typeList);
	}
	return indexTypeMapping;
}
 
开发者ID:raghavendar-ts,项目名称:ElasticTab-Elasticsearch-to-Excel-Report,代码行数:22,代码来源:Util.java


示例2: getClusterIndices

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
@Nonnull
@Override
public Set<String> getClusterIndices() {
    final ObjectLookupContainer<String> indices = esClient.admin().cluster().prepareState()
            .execute().actionGet().getState().getMetaData().indices().keys();
    final Set<String> indicesNames = new HashSet<>();
    for (final Object index : indices.toArray()) {
        indicesNames.add(index.toString());
    }
    return indicesNames;
}
 
开发者ID:Biacode,项目名称:escommons,代码行数:12,代码来源:ElasticsearchClientWrapperImpl.java


示例3: getTypeListFromIndex

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
public static List<String> getTypeListFromIndex(String index) {
	List<String> typeList = new ArrayList<String>();
	ClusterStateResponse resp = ESReport.getESClient().admin().cluster().prepareState().execute().actionGet();
	ObjectLookupContainer<String> objectLookupContainer = resp.getState().metaData().index(index).getMappings().keys();
	for(ObjectCursor<String> objectCursor:objectLookupContainer)
	{
		typeList.add(objectCursor.value);
	}
	return typeList;
}
 
开发者ID:raghavendar-ts,项目名称:ElasticTab-Elasticsearch-to-Excel-Report,代码行数:11,代码来源:Util.java


示例4: deleteOldLogs

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
public void deleteOldLogs() throws ConnectionException {
	if(LOGGER.isDebugEnabled()) {
		LOGGER.debug("Deleting old logs...");
	}
	
	List<String> indicesToKeep = createIndicesToKeep();
	
	ObjectLookupContainer<String> indizes = client.admin().cluster().state(new ClusterStateRequest()).actionGet().getState().getMetaData().getIndices().keys();
	Iterator<ObjectCursor<String>> iter = indizes.iterator();
	
	if(LOGGER.isDebugEnabled()) {
		LOGGER.debug("Found " + indizes.size() + " indices.");
	}
	
	while(iter.hasNext()) {
		ObjectCursor<String> cursor = iter.next();
		
		if(!indicesToKeep.contains(cursor.value)) {
			DeleteIndexResponse delete = client.admin().indices().delete(new DeleteIndexRequest(cursor.value)).actionGet();
			if (!delete.isAcknowledged()) {
				LOGGER.warn("Could not delete index " + cursor.value);
			}
		}
	}
	
	if(LOGGER.isDebugEnabled()) {
		LOGGER.debug("Old logs deleted.");
	}
}
 
开发者ID:cternes,项目名称:alfa,代码行数:30,代码来源:LogCleaner.java


示例5: detectSchema

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
@Override
protected SimpleTableDef[] detectSchema() {
    logger.info("Detecting schema for index '{}'", indexName);

    final ClusterStateRequestBuilder clusterStateRequestBuilder = getElasticSearchClient().admin().cluster()
            .prepareState().setIndices(indexName);
    final ClusterState cs = clusterStateRequestBuilder.execute().actionGet().getState();
    
    final List<SimpleTableDef> result = new ArrayList<>();

    final IndexMetaData imd = cs.getMetaData().index(indexName);
    if (imd == null) {
        // index does not exist
        logger.warn("No metadata returned for index name '{}' - no tables will be detected.");
    } else {
        final ImmutableOpenMap<String, MappingMetaData> mappings = imd.getMappings();
        final ObjectLookupContainer<String> documentTypes = mappings.keys();
        for (final ObjectCursor<?> documentTypeCursor : documentTypes) {
            final String documentType = documentTypeCursor.value.toString();
            try {
                final SimpleTableDef table = detectTable(cs, indexName, documentType);
                result.add(table);
            } catch (Exception e) {
                logger.error("Unexpected error during detectTable for document type '{}'", documentType, e);
            }
        }
    }
    return sortTables(result);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:30,代码来源:ElasticSearchDataContext.java


示例6: intersection

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
/**
 * @return an intersection view over the two specified containers (which can be KeyContainer or ObjectHashSet).
 */
// Hppc has forEach, but this means we need to build an intermediate set, with this method we just iterate
// over each unique value without creating a third set.
public static <T> Iterable<T> intersection(ObjectLookupContainer<T> container1, final ObjectLookupContainer<T> container2) {
    assert container1 != null && container2 != null;
    final Iterator<ObjectCursor<T>> iterator = container1.iterator();
    final Iterator<T> intersection = new Iterator<T>() {

        T current;

        @Override
        public boolean hasNext() {
            if (iterator.hasNext()) {
                do {
                    T next = iterator.next().value;
                    if (container2.contains(next)) {
                        current = next;
                        return true;
                    }
                } while (iterator.hasNext());
            }
            return false;
        }

        @Override
        public T next() {
            return current;
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new Iterable<T>() {
        @Override
        public Iterator<T> iterator() {
            return intersection;
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:44,代码来源:HppcMaps.java


示例7: keys

import com.carrotsearch.hppc.ObjectLookupContainer; //导入依赖的package包/类
/**
 * Returns a specialized view of the keys of this associated container.
 * The view additionally implements {@link ObjectLookupContainer}.
 */
public ObjectLookupContainer<KType> keys() {
    return map.keys();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:ImmutableOpenMap.java



注:本文中的com.carrotsearch.hppc.ObjectLookupContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CacheEntry类代码示例发布时间:2022-05-23
下一篇:
Java BinaryExpression类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap