org.elasticsearch.indices.IndicesService.cacheShardLevelResult()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中org.elasticsearch.indices.IndicesService.cacheShardLevelResult()方法的一些代码示例,展示了IndicesService.cacheShardLevelResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesService.cacheShardLevelResult()方法的具体详情如下:
包路径:org.elasticsearch.indices.IndicesService
类名称:IndicesService
方法名:cacheShardLevelResult

IndicesService.cacheShardLevelResult介绍

[英]Cache something calculated at the shard level.
[中]缓存在碎片级别计算的内容。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

BytesReference bytesReference = cacheShardLevelResult(context.indexShard(), directoryReader, request.cacheKey(),
  out -> {
  queryPhase.execute(context);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * Fetch {@linkplain FieldStats} for a field. These stats are cached until the shard changes.
 * @param shard the shard to use with the cache key
 * @param searcher searcher to use to lookup the field stats
 * @param field the actual field
 * @param useCache should this request use the cache?
 */
public FieldStats<?> getFieldStats(IndexShard shard, Engine.Searcher searcher, String field, boolean useCache) throws Exception {
  MappedFieldType fieldType = shard.mapperService().fullName(field);
  if (fieldType == null) {
    return null;
  }
  if (useCache == false) {
    return fieldType.stats(searcher.reader());
  }
  BytesReference cacheKey = new BytesArray("fieldstats:" + field);
  BytesReference statsRef = cacheShardLevelResult(shard, searcher.getDirectoryReader(), cacheKey, out -> {
    try {
      out.writeOptionalWriteable(fieldType.stats(searcher.reader()));
    } catch (IOException e) {
      throw new IllegalStateException("Failed to write field stats output", e);
    }
  });
  try (StreamInput in = statsRef.streamInput()) {
    return in.readOptionalWriteable(FieldStats::readFrom);
  }
}

代码示例来源:origin: apache/servicemix-bundles

BytesReference bytesReference = cacheShardLevelResult(context.indexShard(), directoryReader, request.cacheKey(), out -> {
  queryPhase.execute(context);
  try {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

BytesReference bytesReference = cacheShardLevelResult(context.indexShard(), directoryReader, request.cacheKey(), out -> {
  queryPhase.execute(context);
  try {

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

BytesReference bytesReference = cacheShardLevelResult(context.indexShard(), directoryReader, request.cacheKey(), out -> {
  queryPhase.execute(context);
  try {

相关文章

微信公众号

最新文章

更多