resthighlevelclient如何移除include_type_name
时间: 2024-01-14 21:03:33 浏览: 35
在 Elasticsearch 7.0 版本及以上,include_type_name 已经被废弃。如果您使用的是 Elasticsearch 7.0 或更高版本,可以直接将 include_type_name 设置为 false,以移除它。例如:
```java
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost", 9200, "http"))
.setHttpClientConfigCallback(httpClientBuilder ->
httpClientBuilder.setRoutePlanner(new HttpRoutePlanner() {
@Override
public HttpHost determineProxy(HttpHost target,
HttpRequest request, HttpContext context) throws HttpException {
return null;
}
@Override
public HttpRoute determineRoute(HttpHost target,
HttpRequest request, HttpContext context) throws HttpException {
return new HttpRoute(target);
}
@Override
public void setProxy(HttpHost proxy) {
}
})
)
.setRequestConfigCallback(requestConfigBuilder ->
requestConfigBuilder
.setConnectTimeout(5000)
.setSocketTimeout(60000)
)
);
```
如果您使用的是 Elasticsearch 6.x 版本,则需要将它设置为 true。但是,值得注意的是,include_type_name 在 Elasticsearch 7.x 版本中已经被废弃,建议在应用中尽快移除它。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)