[TEST] Use client node such that we always have to do a round-trip to do a fetch.
This commit is contained in:
parent
5f1d9af9fe
commit
ff039019c5
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -264,4 +265,17 @@ public class SearchStats implements Streamable, ToXContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
try {
|
||||||
|
XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint();
|
||||||
|
builder.startObject();
|
||||||
|
toXContent(builder, EMPTY_PARAMS);
|
||||||
|
builder.endObject();
|
||||||
|
return builder.string();
|
||||||
|
} catch (IOException e) {
|
||||||
|
return "{ \"error\" : \"" + e.getMessage() + "\"}";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,12 +91,13 @@ public class SearchStatsTests extends ElasticsearchIntegrationTest {
|
||||||
refresh();
|
refresh();
|
||||||
int iters = scaledRandomIntBetween(20, 50);
|
int iters = scaledRandomIntBetween(20, 50);
|
||||||
for (int i = 0; i < iters; i++) {
|
for (int i = 0; i < iters; i++) {
|
||||||
SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.termQuery("field", "value")).setStats("group1", "group2").execute().actionGet();
|
SearchResponse searchResponse = cluster().clientNodeClient().prepareSearch().setQuery(QueryBuilders.termQuery("field", "value")).setStats("group1", "group2").execute().actionGet();
|
||||||
assertHitCount(searchResponse, docsTest1 + docsTest2);
|
assertHitCount(searchResponse, docsTest1 + docsTest2);
|
||||||
assertAllSuccessful(searchResponse);
|
assertAllSuccessful(searchResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet();
|
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet();
|
||||||
|
logger.debug("###### indices search stats: " + indicesStats.getTotal().getSearch());
|
||||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryCount(), greaterThan(0l));
|
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryCount(), greaterThan(0l));
|
||||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryTimeInMillis(), greaterThan(0l));
|
assertThat(indicesStats.getTotal().getSearch().getTotal().getQueryTimeInMillis(), greaterThan(0l));
|
||||||
assertThat(indicesStats.getTotal().getSearch().getTotal().getFetchCount(), greaterThan(0l));
|
assertThat(indicesStats.getTotal().getSearch().getTotal().getFetchCount(), greaterThan(0l));
|
||||||
|
|
Loading…
Reference in New Issue