以下代码仅适用于ElasticSearchClient。我想使用RestHighLevelClient 6.2.4版本。
checkAuthStatus(){
firebase.auth().onAuthStateChanged(user => {
this.setState({ btnWithImg: user });
if(user !== null){
this.setState({ userIsLoggedIn: true });
this.props.toggleLogIn();
}
});
}
答案 0 :(得分:1)
Delete by Query API之前的RestHighLevelClient仅支持version 6.5 and above。
如果您使用的是6.2.4,尽管如此,您仍然可以使用低级客户端调用_delete_by_query
端点:
Response response = restClient.performRequest("POST", "/persons/_delete_by_query");
String jsonResponse = EntityUtils.toString(response.getEntity());
// parse the JSON and do something
如果您需要传递查询,可以这样做:
Map<String, String> params = Collections.emptyMap();
String jsonString = "{ \"query\": { \"range\" : { \"age\" : { \"gte\" : 10 } } } }";
HttpEntity query = new NStringEntity(jsonString, ContentType.APPLICATION_JSON);
Response response = restClient.performRequest("POST", "/persons/_delete_by_query", params, query);
String jsonResponse = EntityUtils.toString(response.getEntity());
// parse the JSON and do something