本文整理汇总了Java中io.searchbox.client.http.JestHttpClient类的典型用法代码示例。如果您正苦于以下问题:Java JestHttpClient类的具体用法?Java JestHttpClient怎么用?Java JestHttpClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JestHttpClient类属于io.searchbox.client.http包,在下文中一共展示了JestHttpClient类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
JestHttpClient build() {
JestClientFactory factory = new JestClientFactory();
Builder builder =
new HttpClientConfig.Builder(cfg.urls)
.multiThreaded(true)
.discoveryEnabled(false)
.connTimeout((int) cfg.connectionTimeout)
.maxConnectionIdleTime(cfg.maxConnectionIdleTime, cfg.maxConnectionIdleUnit)
.maxTotalConnection(cfg.maxTotalConnection)
.readTimeout(cfg.readTimeout)
.requestCompressionEnabled(cfg.requestCompression)
.discoveryFrequency(1L, TimeUnit.MINUTES);
if (cfg.username != null && cfg.password != null) {
builder.defaultCredentials(cfg.username, cfg.password);
}
factory.setHttpClientConfig(builder.build());
return (JestHttpClient) factory.getObject();
}
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:JestClientBuilder.java
示例2: should_jest_auto_configuration_have_custom_httpbuilder
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
@Test
public void should_jest_auto_configuration_have_custom_httpbuilder() {
RequestConfig config = ((Configurable) ((JestHttpClient) jestClient).getHttpClient()).getConfig();
int connectTimeout = config.getConnectTimeout();
assertThat(connectTimeout, is(3551));
}
开发者ID:VanRoy,项目名称:spring-data-jest,代码行数:9,代码来源:ElasticsearchJestAutoConfigurationWithCustomHttpConfigurerTest.java
示例3: setUp
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
final JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(
new HttpClientConfig
.Builder("http://localhost:" + getPort())
.multiThreaded(true).build()
);
client = (JestHttpClient) factory.getObject();
converter = new DataConverter(true, BehaviorOnNullValues.IGNORE);
}
开发者ID:confluentinc,项目名称:kafka-connect-elasticsearch,代码行数:13,代码来源:ElasticsearchSinkTestBase.java
示例4: main
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// Construct a new Jest client according to configuration via factory
JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig
.Builder("http://api.exiletools.com/index")
.multiThreaded(true)
.build());
JestHttpClient client = (JestHttpClient) factory.getObject();
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
// searchSourceBuilder.query(QueryBuilders.matchQuery("info.name", "Tabula Rasa"));
searchSourceBuilder.query(QueryBuilders.matchQuery("info.name", "Mjolner"));
searchSourceBuilder.size(1);
System.out.println(searchSourceBuilder.toString());
ExileToolsSearchAction search = new ExileToolsSearchAction.Builder(searchSourceBuilder.toString())
.setHeader("Authorization", "DEVELOPMENT-Indexer")
.build();
SearchResult result = client.execute(search);
System.out.println(result.getPathToResult());
System.out.println(result.getJsonString());
List<Hit<ExileToolsHit, Void>> articles = result.getHits(ExileToolsHit.class);
System.out.println(articles);
articles.stream().forEach( (e) -> {
System.out.println(e.source.getMd5sum());
System.out.println(e.source.getInfo());
System.out.println(e.source.getAttributes());
System.out.println(e.source.getShop());
System.out.println(e.source.getSockets());
} );
client.shutdownClient();
}
开发者ID:thirdy,项目名称:blackmarket,代码行数:42,代码来源:Main.java
示例5: ExileToolsSearchClient
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
public ExileToolsSearchClient(String url, String apiKey) {
this.apiKey = apiKey;
// Construct a new Jest client according to configuration via factory
JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig.Builder(url).multiThreaded(true).build());
client = (JestHttpClient) factory.getObject();
logger.debug("~~~~~~~~~~~~~~~~~~ Successfully started ExileToolsESClient ~~~~~~~~~~~~~~~~~~~~");
}
开发者ID:thirdy,项目名称:blackmarket,代码行数:9,代码来源:ExileToolsSearchClient.java
示例6: testESInit
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
@Test
public void testESInit() {
JestHttpClient client = ElasticsearchInit.getClient();
System.out.println("->> "+client.getServers());
System.out.println("->> "+client.getAsyncClient());
client.shutdownClient();
}
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:8,代码来源:TestElasticsearchInit.java
示例7: customGson
import io.searchbox.client.http.JestHttpClient; //导入依赖的package包/类
@Test
public void customGson() {
load(CustomGson.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
JestHttpClient client = (JestHttpClient) this.context.getBean(JestClient.class);
assertThat(client.getGson()).isSameAs(this.context.getBean("customGson"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:JestAutoConfigurationTests.java
注:本文中的io.searchbox.client.http.JestHttpClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论