当前位置: 首页>>代码示例>>Java>>正文


Java SearchPhaseExecutionException.getRootCause方法代码示例

本文整理汇总了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;
        }
    }

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:PercentilesBucketIT.java

示例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;
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:28,代码来源:DerivativeIT.java

示例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;
        }
    }

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:34,代码来源:PercentilesBucketIT.java

示例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;
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:ExtendedStatsBucketIT.java


注:本文中的org.elasticsearch.action.search.SearchPhaseExecutionException.getRootCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。