org.elasticsearch.common.collect.ImmutableMap.of()方法的使用及代码示例

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

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

ImmutableMap.of介绍

暂无

代码示例

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

private void updateIndexRefresh(String name, Object value) {
  esClient.admin().indices().prepareUpdateSettings(name).setSettings(ImmutableMap.of("index.refresh_interval", value)).get();
}

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

try {
  ExecutableScript executableScript = scriptService.executable(definition.getScriptType(), definition.getScript(),
      ScriptService.ScriptType.INLINE, ImmutableMap.<String, Object>of("logger", logger));
  if (logger.isTraceEnabled()) {
    logger.trace("Script to be executed: {} - {}", definition.getScriptType(), definition.getScript());

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

ScriptService.ScriptType.INLINE, ImmutableMap.<String, Object>of("logger", logger));
executableScript.setNextVar("ctx", ctx);
executableScript.run();

代码示例来源:origin: elastic/elasticsearch-hdfs

public ImmutableMap<String, BlobMetaData> listBlobs() throws IOException {
  FileStatus[] files = blobStore.fileSystem().listStatus(path);
  if (files == null || files.length == 0) {
    return ImmutableMap.of();
  }
  ImmutableMap.Builder<String, BlobMetaData> builder = ImmutableMap.builder();
  for (FileStatus file : files) {
    builder.put(file.getPath().getName(), new PlainBlobMetaData(file.getPath().getName(), file.getLen()));
  }
  return builder.build();
}

代码示例来源:origin: elastic/elasticsearch-hdfs

@Override
public ImmutableMap<String, BlobMetaData> listBlobsByPrefix(final String blobNamePrefix) throws IOException {
  FileStatus[] files = blobStore.fileSystem().listStatus(path, new PathFilter() {
    @Override
    public boolean accept(Path path) {
      return path.getName().startsWith(blobNamePrefix);
    }
  });
  if (files == null || files.length == 0) {
    return ImmutableMap.of();
  }
  ImmutableMap.Builder<String, BlobMetaData> builder = ImmutableMap.builder();
  for (FileStatus file : files) {
    builder.put(file.getPath().getName(), new PlainBlobMetaData(file.getPath().getName(), file.getLen()));
  }
  return builder.build();
}

代码示例来源:origin: com.bazaarvoice.elasticsearch.client/es-client-java-core

@Override public GetResponse fromXContent(final Map<String, Object> map) {
    final Map<String, GetField> fields;
    if (map.containsKey("fields")) {
      Map<String, Object> incoming = nodeMapValue(map.get("fields"), String.class, Object.class);
      fields = Maps.newHashMapWithExpectedSize(incoming.size());
      for (Map.Entry<String, Object> entry : incoming.entrySet()) {
        if (entry.getValue() instanceof List) {
          fields.put(entry.getKey(), new GetField(entry.getKey(), nodeListValue(entry.getValue(), Object.class)));
        } else {
          fields.put(entry.getKey(), new GetField(entry.getKey(), ImmutableList.of(entry.getValue())));
        }
      }
    } else {
      fields = ImmutableMap.of();
    }

    return new GetResponse(new GetResult(
      nodeStringValue(map.get("_index")),
      nodeStringValue(map.get("_type")),
      nodeStringValue(map.get("_id")),
      nodeLongValue(map.get("_version"), -1),
      nodeBooleanValue(map.get("found"), true),
      nodeBytesReferenceValue(map.get("_source")),
      fields
    ));
  }
}

代码示例来源:origin: com.bazaarvoice.elasticsearch.client/es-rest-client-core-1.4

@Override public GetResponse fromXContent(final Map<String, Object> map) {
    final Map<String, GetField> fields;
    if (map.containsKey("fields")) {
      Map<String, Object> incoming = nodeMapValue(map.get("fields"), String.class, Object.class);
      fields = Maps.newHashMapWithExpectedSize(incoming.size());
      for (Map.Entry<String, Object> entry : incoming.entrySet()) {
        if (entry.getValue() instanceof List) {
          fields.put(entry.getKey(), new GetField(entry.getKey(), nodeListValue(entry.getValue(), Object.class)));
        } else {
          fields.put(entry.getKey(), new GetField(entry.getKey(), ImmutableList.of(entry.getValue())));
        }
      }
    } else {
      fields = ImmutableMap.of();
    }

    //noinspection unchecked
    return new GetResponse(new GetResult(
      nodeStringValue(map.get("_index")),
      nodeStringValue(map.get("_type")),
      nodeStringValue(map.get("_id")),
      nodeLongValue(map.get("_version"), -1),
      nodeBooleanValue(map.get("found"), true),
      nodeBytesReferenceForMapValue((Map<String, ?>) map.get("_source")),
      fields
    ));
  }
}

代码示例来源:origin: meltwater/elasticsearch-batch-percolator

private void executeSearch(SearchContext context, QueryAndSource queryAndSource) {
  parseHighlighting(context, queryAndSource.getSource());
  context.parsedQuery(new ParsedQuery(queryAndSource.getQuery(), ImmutableMap.<String, Filter>of()));
  if (context.from() == -1) {
    context.from(0);
  }
  if (context.size() == -1) {
    context.size(Integer.MAX_VALUE);
  }
  queryPhase.preProcess(context);
  fetchPhase.preProcess(context);
  queryPhase.execute(context);
  setDocIdsToLoad(context);
  fetchPhase.execute(context);
}

相关文章