本文整理汇总了Java中org.elasticsearch.action.bulk.BulkAction.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java BulkAction.INSTANCE属性的具体用法?Java BulkAction.INSTANCE怎么用?Java BulkAction.INSTANCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.elasticsearch.action.bulk.BulkAction
的用法示例。
在下文中一共展示了BulkAction.INSTANCE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareBulk
@Override
public BulkRequestBuilder prepareBulk() {
return new BulkRequestBuilder(this, BulkAction.INSTANCE);
}
示例2: getAction
public BulkAction getAction() {
return BulkAction.INSTANCE;
}
示例3: testSearch
@Test
public void testSearch() throws Exception {
Client client = client("1");
long t0 = System.currentTimeMillis();
BulkRequestBuilder builder = new BulkRequestBuilder(client, BulkAction.INSTANCE);
for (int i = 0; i < 1000; i++) {
builder.add(indexRequest()
.index("pages").type("row")
.source(jsonBuilder()
.startObject()
.field("user1", "kimchy")
.field("user2", "kimchy")
.field("user3", "kimchy")
.field("user4", "kimchy")
.field("user5", "kimchy")
.field("user6", "kimchy")
.field("user7", "kimchy")
.field("user8", "kimchy")
.field("user9", "kimchy")
.field("rowcount", i)
.field("rs", 1234)));
}
client.bulk(builder.request()).actionGet();
client.admin().indices().refresh(refreshRequest()).actionGet();
long t1 = System.currentTimeMillis();
logger.info("t1-t0 = {}", t1-t0);
for (int i = 0; i < 100; i++) {
t1 = System.currentTimeMillis();
QueryBuilder queryStringBuilder =
QueryBuilders.queryStringQuery("rs:" + 1234);
SearchRequestBuilder requestBuilder = client.prepareSearch()
.setIndices("pages")
.setTypes("row")
.setQuery(queryStringBuilder)
.addSort("rowcount", SortOrder.DESC)
.setFrom(i*10).setSize(10);
SearchResponse response = requestBuilder.execute().actionGet();
long t2 = System.currentTimeMillis();
logger.info("t2-t1 = {}", t2-t1);
}
}