Same query return different result

I have 3 servers,i find that same query has different result
ip1:9200 and ip2:9200 return right result,but ip3:9200 return wrong result.
ip1 and ip2 result:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 7,
"max_score": null,
"hits": [
{
......

ip3 result:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 3,
"failed": 0
},
"hits": {
"total": 3,
"max_score": null,
"hits": [
{
......

client initmode :
Settings settings = Settings.builder()
.put("cluster.name", config.getEsClusterName())
.put("client.transport.sniff", true)
.put("client.transport.ping_timeout", "60s").build();
try {
client = new PreBuiltTransportClient(settings);
String[] ips = config.getEsClusterIp().split(",");
for (String ip : ips) {
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ip), Integer.valueOf(config.getEsClusterPort())));
}
query mode:
SearchRequestBuilder requestBuilder = client.prepareSearch(config.getIndex()).setTypes(config.getType())
.setPreference("_primary")
.setQuery(boolQueryBuilder)
.setFrom(Integer.valueOf(startIndex))
.setSize(Integer.valueOf(pageSize))
.addSort(sortBuilder);
This problem has been bothering me for a long time. Please help me,thanks!

Hey,

take a closer look ay your responses. First query

"_shards": {
  “total”: 5,
  “successful”: 5,
  “failed”: 0
}

second query

"_shards": {
  “total”: 5,
  “successful”: 3,
  “failed”: 0
}

The second query did span the same number of shards than the first one. Looks as if some shards were not reachable during query execution. Maybe you cluster has stability issues.

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.