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

x33g5p2x  于2022-01-25 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(108)

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

Maps.newHashMap介绍

暂无

代码示例

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

private void logStatistics(long duration) {
    if (definition.isStoreStatistics()) {
      long totalDocuments = deletedDocuments.get() + insertedDocuments.get();
      logger.trace("Indexed {} documents: {} insertions, {} updates, {} deletions", totalDocuments, insertedDocuments.get(),
          updatedDocuments.get(), deletedDocuments.get());
      Map<String, Object> source = new HashMap<String, Object>();
      Map<String, Object> statistics = Maps.newHashMap();
      statistics.put("duration", duration);
      statistics.put("date", new Date());
      statistics.put("index", index);
      statistics.put("type", type);
      statistics.put("documents.inserted", insertedDocuments.get());
      statistics.put("documents.updated", updatedDocuments.get());
      statistics.put("documents.deleted", deletedDocuments.get());
      statistics.put("documents.total", documentCount.get());
      source.put("statistics", statistics);
      client.prepareIndex(definition.getStatisticsIndexName(), definition.getStatisticsTypeName()).setSource(source).get();
    }
  }
}

代码示例来源:origin: apache/flume

private void appendHeaders(XContentBuilder builder, Event event)
  throws IOException {
 Map<String, String> headers = Maps.newHashMap(event.getHeaders());

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

initalTimestampSettings.get(INITIAL_TIMESTAMP_SCRIPT_FIELD).toString(), ScriptService.ScriptType.INLINE, Maps.<String, Object>newHashMap());
Object ctx = scriptExecutable.run();
logger.trace("initialTimestamp script returned: {}", ctx);

代码示例来源:origin: jprante/elasticsearch-gatherer

public PlainIndexableObject() {
  this.meta = newHashMap();
  this.source = newHashMap();
}

代码示例来源:origin: jprante/elasticsearch-gatherer

public GathererRegistry(Map<String, Class<? extends Module>> gathererModules) {
  this.gathererModules = gathererModules;
  this.gatherers = newHashMap();
}

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

public BatchPercolateResponseItem(String docId){
  this.matches = Maps.newHashMap();
  this.docId = docId;
}

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

public QueryMatch(){
  hls = Maps.newHashMap();
}

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

public BatchPercolateResponseItem(){
  this.matches = Maps.newHashMap();
}

代码示例来源:origin: alien4cloud/alien4cloud

private InstanceInformation newInstance(int i) {
  Map<String, String> attributes = Maps.newHashMap();
  attributes.put(PUBLIC_IP, "10.52.0." + i);
  attributes.put(TOSCA_ID, "1.0-wd03");
  attributes.put(TOSCA_NAME, "TOSCA-Simple-Profile-YAML");
  Map<String, String> runtimeProperties = Maps.newHashMap();
  runtimeProperties.put(PUBLIC_IP, "10.52.0." + i);
  Map<String, String> outputs = Maps.newHashMap();
  return new InstanceInformation(ToscaNodeLifecycleConstants.INITIAL, InstanceStatus.PROCESSING, attributes, runtimeProperties, outputs);
}

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

private Map<String, BatchPercolateResponseItem> emptyPeroclateResponses(List<ParsedDocument> parsedDocuments) {
  Map<String, BatchPercolateResponseItem> items = Maps.newHashMap();
  for(ParsedDocument document : parsedDocuments){
    items.put(document.id(),
        new BatchPercolateResponseItem(Maps.<String, QueryMatch>newHashMap(), document.id()));
  }
  return items;
}

代码示例来源:origin: alien4cloud/alien4cloud

/**
 * Load a map of MetaPropConfiguration from given ids.
 * 
 * @param ids The ids to fetch
 * @return The a map id -> MetaPropConfiguration
 */
public Map<String, MetaPropConfiguration> getByIds(String[] ids) {
  Map<String, MetaPropConfiguration> configurationMap = Maps.newHashMap();
  List<MetaPropConfiguration> configurations = alienDAO.findByIds(MetaPropConfiguration.class, ids);
  for (MetaPropConfiguration configuration : configurations) {
    configurationMap.put(configuration.getId(), configuration);
  }
  return configurationMap;
}

代码示例来源:origin: alien4cloud/alien4cloud

/**
 *
 * @param name
 * @return the
 */
public String getMetapropertykeyByName(String name, String target) {
  Map<String, String[]> filters = Maps.newHashMap();
  filters.put("name", new String[]{name});
  filters.put("target", new String[]{target.toString()});
  GetMultipleDataResult<MetaPropConfiguration> result = alienDAO.find(MetaPropConfiguration.class, filters, 1);
  if (result.getTotalResults() > 0) {
    return result.getData()[0].getId();
  }
  return null;
}

代码示例来源:origin: alien4cloud/alien4cloud

/**
 * Convert a tag list to a map
 *
 * @param tags
 *            The list of tags to convert in a map.
 * @return The value of the tag or null if no value exists.
 */
public static Map<String, String> tagListToMap(List<Tag> tags) {
  Map<String, String> tagMap = Maps.newHashMap();
  for (Tag tag : safe(tags)) {
    tagMap.put(tag.getName(), tag.getValue());
  }
  return tagMap;
}

代码示例来源:origin: alien4cloud/alien4cloud

private void updateDeploymentExecutionId(Deployment deployment, String workflowId, String executionId) {
  if (deployment.getWorkflowExecutions() == null) {
    Map<String, String> workflowExecutions = Maps.newHashMap();
    deployment.setWorkflowExecutions(workflowExecutions);
  }
  String knownExecutionId = deployment.getWorkflowExecutions().get(workflowId);
  if (knownExecutionId == null || !executionId.equals(knownExecutionId)) {
    deployment.getWorkflowExecutions().put(workflowId, executionId);
    alienDAO.save(deployment);
  }
}

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

@Override
public void readFrom(StreamInput in) throws IOException {
  docId = in.readString();
  matches = Maps.newHashMap();
  int mSize = in.readVInt();
  for (int j = 0; j < mSize; j++) {
    QueryMatch queryMatch = new QueryMatch();
    queryMatch.readFrom(in);
    matches.put(in.readString(), queryMatch);
  }
}

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

@Override
public void readFrom(StreamInput in) throws IOException {
  super.readFrom(in);
  responseItems = Maps.newHashMap();
  int size = in.readVInt();
  for(int i = 0; i < size; i++){
    String docId = in.readString();
    BatchPercolateResponseItem item = new BatchPercolateResponseItem();
    item.readFrom(in);
    responseItems.put(docId, item);
  }
}

代码示例来源:origin: jprante/elasticsearch-transport-websocket

public NettyHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request) {
  this.request = request;
  this.params = newHashMap();
  this.content = request.getContent().readable() ?
      new ChannelBufferBytesReference(request.getContent()) :
      BytesArray.EMPTY;
  this.uri = request.getUri();
  int pathEndPos = uri.indexOf('?');
  if (pathEndPos < 0) {
    this.rawPath = uri;
  } else {
    this.rawPath = uri.substring(0, pathEndPos);
    RestUtils.decodeQueryString(uri, pathEndPos + 1, params);
  }
}

代码示例来源:origin: alien4cloud/alien4cloud

@When("^I update \"([^\"]*)\" user's fields:$")
public void I_update_user_s_fields(String username, List<Entry> fields) throws Throwable {
  Map<String, String> fieldsMap = Maps.newHashMap();
  for (Entry field : fields) {
    fieldsMap.put(field.getName(), field.getValue());
  }
  String resp = Context.getRestClientInstance().putJSon("/rest/v1/users/" + username, JsonUtil.toString(fieldsMap));
  System.out.println(resp);
  Context.getInstance().registerRestResponse(resp);
}

代码示例来源:origin: alien4cloud/alien4cloud

@When("^I set the \"([^\"]*)\" of this application to \"([^\"]*)\"$")
public void I_set_the_of_this_application_to(String fieldName, String fieldValue) throws Throwable {
  Map<String, Object> request = Maps.newHashMap();
  request.put(fieldName, fieldValue);
  Context.getInstance()
      .registerRestResponse(getRestClientInstance().putJSon("/rest/v1/applications/" + CURRENT_APPLICATION.getId(), JsonUtil.toString(request)));
  ReflectionUtil.setPropertyValue(CURRENT_APPLICATION, fieldName, fieldValue);
}

代码示例来源:origin: alien4cloud/alien4cloud

@When("^I update the \"([^\"]*)\" group fields:$")
public void I_update_the_group_fields(String name, List<Entry> fields) throws Throwable {
  Map<String, String> fieldsMap = Maps.newHashMap();
  for (Entry field : fields) {
    fieldsMap.put(field.getName(), field.getValue());
  }
  Context.getInstance().registerRestResponse(
      Context.getRestClientInstance().putJSon("/rest/v1/groups/" + Context.getInstance().getGroupId(name), JsonUtil.toString(fieldsMap)));
}

相关文章

微信公众号

最新文章

更多