本文整理汇总了Java中org.elasticsearch.action.search.SearchPhaseExecutionException.getRootCause方法的典型用法代码示例。如果您正苦于以下问题:Java SearchPhaseExecutionException.getRootCause方法的具体用法?Java SearchPhaseExecutionException.getRootCause怎么用?Java SearchPhaseExecutionException.getRootCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.action.search.SearchPhaseExecutionException
的用法示例。
在下文中一共展示了SearchPhaseExecutionException.getRootCause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBadPercents
import org.elasticsearch.action.search.SearchPhaseExecutionException; //导入方法依赖的package包/类
public void testBadPercents() throws Exception {
double[] badPercents = {-1.0, 110.0};
try {
client().prepareSearch("idx")
.addAggregation(terms("terms").field("tag").subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)))
.addAggregation(percentilesBucket("percentiles_bucket", "terms>sum")
.percents(badPercents)).execute().actionGet();
fail("Illegal percent's were provided but no exception was thrown.");
} catch (Exception e) {
Throwable cause = ExceptionsHelper.unwrapCause(e);
if (cause == null) {
throw e;
} else if (cause instanceof SearchPhaseExecutionException) {
SearchPhaseExecutionException spee = (SearchPhaseExecutionException) e;
Throwable rootCause = spee.getRootCause();
if (!(rootCause instanceof IllegalArgumentException)) {
throw e;
}
} else if (!(cause instanceof IllegalArgumentException)) {
throw e;
}
}
}
示例2: testSingleValueAggDerivative_invalidPath
import org.elasticsearch.action.search.SearchPhaseExecutionException; //导入方法依赖的package包/类
public void testSingleValueAggDerivative_invalidPath() throws Exception {
try {
client().prepareSearch("idx")
.addAggregation(
histogram("histo")
.field(SINGLE_VALUED_FIELD_NAME)
.interval(interval)
.subAggregation(
filters("filters", QueryBuilders.termQuery("tag", "foo")).subAggregation(
sum("sum").field(SINGLE_VALUED_FIELD_NAME)))
.subAggregation(derivative("deriv", "filters>get>sum"))).execute().actionGet();
fail("Expected an Exception but didn't get one");
} catch (Exception e) {
Throwable cause = ExceptionsHelper.unwrapCause(e);
if (cause == null) {
throw e;
} else if (cause instanceof SearchPhaseExecutionException) {
SearchPhaseExecutionException spee = (SearchPhaseExecutionException) e;
Throwable rootCause = spee.getRootCause();
if (!(rootCause instanceof IllegalArgumentException)) {
throw e;
}
} else if (!(cause instanceof IllegalArgumentException)) {
throw e;
}
}
}
示例3: testBadPercents_asSubAgg
import org.elasticsearch.action.search.SearchPhaseExecutionException; //导入方法依赖的package包/类
public void testBadPercents_asSubAgg() throws Exception {
double[] badPercents = {-1.0, 110.0};
try {
client()
.prepareSearch("idx")
.addAggregation(
terms("terms")
.field("tag")
.order(Terms.Order.term(true))
.subAggregation(
histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval)
.extendedBounds(minRandomValue, maxRandomValue))
.subAggregation(percentilesBucket("percentiles_bucket", "histo>_count")
.percents(badPercents))).execute().actionGet();
fail("Illegal percent's were provided but no exception was thrown.");
} catch (Exception e) {
Throwable cause = ExceptionsHelper.unwrapCause(e);
if (cause == null) {
throw e;
} else if (cause instanceof SearchPhaseExecutionException) {
SearchPhaseExecutionException spee = (SearchPhaseExecutionException) e;
Throwable rootCause = spee.getRootCause();
if (!(rootCause instanceof IllegalArgumentException)) {
throw e;
}
} else if (!(cause instanceof IllegalArgumentException)) {
throw e;
}
}
}
示例4: testBadSigmaAsSubAgg
import org.elasticsearch.action.search.SearchPhaseExecutionException; //导入方法依赖的package包/类
public void testBadSigmaAsSubAgg() throws Exception {
try {
SearchResponse response = client()
.prepareSearch("idx")
.addAggregation(
terms("terms")
.field("tag")
.order(Order.term(true))
.subAggregation(
histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval)
.extendedBounds(minRandomValue, maxRandomValue)
.subAggregation(sum("sum").field(SINGLE_VALUED_FIELD_NAME)))
.subAggregation(extendedStatsBucket("extended_stats_bucket", "histo>sum")
.sigma(-1.0))).execute().actionGet();
fail("Illegal sigma was provided but no exception was thrown.");
} catch (Exception e) {
Throwable cause = ExceptionsHelper.unwrapCause(e);
if (cause == null) {
throw e;
} else if (cause instanceof SearchPhaseExecutionException) {
SearchPhaseExecutionException spee = (SearchPhaseExecutionException) e;
Throwable rootCause = spee.getRootCause();
if (!(rootCause instanceof IllegalArgumentException)) {
throw e;
}
} else if (!(cause instanceof IllegalArgumentException)) {
throw e;
}
}
}