org.elasticsearch.client.Requests.createIndexRequest()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(245)

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

Requests.createIndexRequest介绍

[英]Creates a create index request.
[中]创建创建索引请求。

代码示例

代码示例来源:origin: spring-projects/spring-data-elasticsearch

@Override
public boolean createIndex(String indexName) {
  Assert.notNull(indexName, "No index defined for Query");
  try {
    return client.indices().create(Requests.createIndexRequest(indexName)).isAcknowledged();
  } catch (Exception e) {
    throw new ElasticsearchException("Failed to create index " + indexName, e);
  }
}

代码示例来源:origin: dqeasycloud/easy-cloud

@Override
public boolean createIndex(String indexName) {
  Assert.notNull(indexName, "No index defined for Query");
  return getIndicesAdminClient().create(Requests.createIndexRequest(indexName)).actionGet().isAcknowledged();
}

代码示例来源:origin: dstl/baleen

private boolean createIndex() {
 if (!esResource
   .getClient()
   .admin()
   .indices()
   .exists(Requests.indicesExistsRequest(index))
   .actionGet()
   .isExists()) {
  esResource
    .getClient()
    .admin()
    .indices()
    .create(Requests.createIndexRequest(index))
    .actionGet();
  return true;
 }
 return false;
}

代码示例来源:origin: SpringDataElasticsearchDevs/spring-data-elasticsearch

private boolean createIndex(String indexName) {
  return client.admin().indices().create(Requests.createIndexRequest(indexName).
      settings(new MapBuilder<String, String>().put("index.refresh_interval", "-1").map())).actionGet().acknowledged();
}

代码示例来源:origin: dstl/baleen

@Override
public boolean createIndex() {
 if (!esResource
   .getClient()
   .admin()
   .indices()
   .exists(Requests.indicesExistsRequest(index))
   .actionGet()
   .isExists()) {
  esResource
    .getClient()
    .admin()
    .indices()
    .create(Requests.createIndexRequest(index))
    .actionGet();
  return true;
 }
 return false;
}

代码示例来源:origin: dstl/baleen

/**
 * Create an index in Elasticsearch. If necessary, this function should check whether a new index
 * is required.
 *
 * @return true if a new index has been created, false otherwise
 */
public boolean createIndex() {
 if (!esResource
   .getClient()
   .admin()
   .indices()
   .exists(Requests.indicesExistsRequest(index))
   .actionGet()
   .isExists()) {
  esResource
    .getClient()
    .admin()
    .indices()
    .create(Requests.createIndexRequest(index))
    .actionGet();
  return true;
 }
 return false;
}

代码示例来源:origin: dstl/baleen

/**
 * Create an index in Elasticsearch. If necessary, this function should check whether a new index
 * is required.
 *
 * @return true if a new index has been created, false otherwise
 */
public boolean createIndex() {
 if (!esResource
   .getClient()
   .admin()
   .indices()
   .exists(Requests.indicesExistsRequest(index))
   .actionGet()
   .isExists()) {
  esResource
    .getClient()
    .admin()
    .indices()
    .create(Requests.createIndexRequest(index))
    .actionGet();
  return true;
 }
 return false;
}

代码示例来源:origin: ezbz/projectx

@Override
 public ActionFuture<CreateIndexResponse> execute(final IndicesAdminClient admin) {
  return admin.create(Requests.createIndexRequest(nodeTemplate.getIndexName()));
 }
});

代码示例来源:origin: SeaseLtd/rated-ranking-evaluator

insertNamespaces(stopwordsPaths, "stopwords_path", configurationFolder, namespace);
final CreateIndexRequest request = createIndexRequest(indexName)
    .settings(Settings.builder().loadFromSource(mapper.writeValueAsString(esconfig.get("settings")), XContentType.JSON).build())
    .mapping("doc", mapper.writeValueAsString(esconfig.get("mappings")), XContentType.JSON);

代码示例来源:origin: sirensolutions/siren-join

public void setupIndex() {
  log("==== INDEX SETUP ====");
  try {
    client.admin().indices().create(createIndexRequest(PARENT_INDEX)).actionGet();
    client.admin().indices().create(createIndexRequest(CHILD_INDEX)).actionGet();
    Thread.sleep(5000);

代码示例来源:origin: sirensolutions/siren-join

public void setupIndex() {
  log("==== INDEX SETUP ====");
  try {
   client.admin().indices().create(createIndexRequest(PARENT_INDEX).mapping(PARENT_TYPE,
       "id", "type=string,index=not_analyzed,doc_values=true",
       "num", "type=integer,doc_values=true")).actionGet();
   client.admin().indices().create(createIndexRequest(CHILD_INDEX).mapping(CHILD_TYPE,
       "id", "type=string,index=not_analyzed,doc_values=true",
       "pid", "type=string,index=not_analyzed,doc_values=true",

相关文章