当前位置: 首页>>代码示例>>Java>>正文


Java Index.Builder方法代码示例

本文整理汇总了Java中io.searchbox.core.Index.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Index.Builder方法的具体用法?Java Index.Builder怎么用?Java Index.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.searchbox.core.Index的用法示例。


在下文中一共展示了Index.Builder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveIndex

import io.searchbox.core.Index; //导入方法依赖的package包/类
@Override
public IEsItem saveIndex(IEsItem doc) throws Exception {
	Index.Builder builder = new Index.Builder(doc);
	if (doc.getIndex() != null) {
		builder.index(doc.getIndex());
	}
	if (doc.getType() != null) {
		builder.type(doc.getType());
	}
	if (doc.getId() != null) {
		builder.id(doc.getId());
	}

	DocumentResult result = _exec(builder.build());
	if (result != null) {
		doc.setIndex(result.getIndex());
		doc.setType(result.getType());
		doc.setId(result.getId());
		return doc;
	}
	return null;
}
 
开发者ID:DataSays,项目名称:wES,代码行数:23,代码来源:JestClient.java

示例2: toIndexRequest

import io.searchbox.core.Index; //导入方法依赖的package包/类
public Index toIndexRequest() {
  Index.Builder req = new Index.Builder(payload)
      .index(key.index)
      .type(key.type)
      .id(key.id);
  if (version != null) {
    req.setParameter("version_type", "external").setParameter("version", version);
  }
  return req.build();
}
 
开发者ID:confluentinc,项目名称:kafka-connect-elasticsearch,代码行数:11,代码来源:IndexableRecord.java

示例3: addElement

import io.searchbox.core.Index; //导入方法依赖的package包/类
@Override
public BulkableAction<DocumentResult> addElement(E element, boolean create) {
    Document document = toDocument(element);
    if (document == null) return null;
    Index.Builder builder = new Index.Builder(document.getFields())
            .index(document.getIndex())
            .type(document.getType())
            .id(document.getId());
    return builder.build();
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:11,代码来源:AbstractDocSchema.java

示例4: executeIndexAsString

import io.searchbox.core.Index; //导入方法依赖的package包/类
protected final Tuple<JestResult, HttpResponse> executeIndexAsString(final String string, final String index, final String type,
        final String id, final boolean mustBeSuccesfull, final boolean connectFromLocalhost) throws Exception {

    client = getJestClient(getServerUri(connectFromLocalhost), username, password);

    Index.Builder builder = new Index.Builder(string).index(index).type(type)/*.refresh(true)*/.setHeader(headers);
    if (id != null && id.length() > 0) {
        builder = builder.id(id);
    }

    final Tuple<JestResult, HttpResponse> restu = client.executeE(builder.build());

    final JestResult res = restu.v1();

    if (mustBeSuccesfull) {
        if (res.getErrorMessage() != null) {
            log.error("Index operation result: " + res.getErrorMessage());
        }
        Assert.assertTrue("Error msg: " + res.getErrorMessage() + res.getJsonString(), res.isSucceeded());
    } else {
        log.error(res.getJsonString());
        log.error("Index operation result fails as expected: " + res.getErrorMessage());
        Assert.assertTrue(!res.isSucceeded());
    }

    return restu;
}
 
开发者ID:petalmd,项目名称:armor,代码行数:28,代码来源:AbstractUnitTest.java

示例5: saveToIndex

import io.searchbox.core.Index; //导入方法依赖的package包/类
public void saveToIndex(SearchEntry entry) {
    Index.Builder indexEntryBuilder = new Index.Builder(entry).id(entry.getId()).index(index).type(entry.getType());

    if (useRefresh) {
        indexEntryBuilder.refresh(true);
    }
    logger.debug("Indexing " + entry.getPath());
    execute(indexEntryBuilder.build());
}
 
开发者ID:spring-io,项目名称:sagan,代码行数:10,代码来源:SearchService.java

示例6: buildIndex

import io.searchbox.core.Index; //导入方法依赖的package包/类
private Index buildIndex(String indexName, String type, String source, String id) {
    Index.Builder builder = new Index.Builder(source).index(indexName).type(type).id(id);
    return builder.build();
}
 
开发者ID:nebula-plugins,项目名称:gradle-metrics-plugin,代码行数:5,代码来源:HttpESMetricsDispatcher.java


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