Search in sources :

Example 6 with ChiSquare

use of org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare in project elasticsearch by elastic.

the class SignificanceHeuristicTests method testAssertions.

public void testAssertions() throws Exception {
    testBackgroundAssertions(new MutualInformation(true, true), new MutualInformation(true, false));
    testBackgroundAssertions(new ChiSquare(true, true), new ChiSquare(true, false));
    testBackgroundAssertions(new GND(true), new GND(false));
    testAssertions(new PercentageScore());
    testAssertions(new JLHScore());
}
Also used : JLHScore(org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHScore) ChiSquare(org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare) MutualInformation(org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation) GND(org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND) PercentageScore(org.elasticsearch.search.aggregations.bucket.significant.heuristics.PercentageScore)

Example 7 with ChiSquare

use of org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare in project elasticsearch by elastic.

the class SignificantTermsIT method testTextAnalysisChiSquare.

public void testTextAnalysisChiSquare() throws Exception {
    SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH).setQuery(new TermQueryBuilder("description", "terje")).setFrom(0).setSize(60).setExplain(true).addAggregation(significantTerms("mySignificantTerms").field("description").executionHint(randomExecutionHint()).significanceHeuristic(new ChiSquare(false, true)).minDocCount(2)).execute().actionGet();
    assertSearchResponse(response);
    SignificantTerms topTerms = response.getAggregations().get("mySignificantTerms");
    checkExpectedStringTermsFound(topTerms);
}
Also used : SignificantTerms(org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms) ChiSquare(org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare) TermQueryBuilder(org.elasticsearch.index.query.TermQueryBuilder) SearchResponse(org.elasticsearch.action.search.SearchResponse) ElasticsearchAssertions.assertSearchResponse(org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse)

Example 8 with ChiSquare

use of org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare in project elasticsearch by elastic.

the class SignificantTermsSignificanceScoreIT method testBackgroundVsSeparateSet.

public void testBackgroundVsSeparateSet() throws Exception {
    String type = randomBoolean() ? "text" : "long";
    String settings = "{\"index.number_of_shards\": 1, \"index.number_of_replicas\": 0}";
    SharedSignificantTermsTestMethods.index01Docs(type, settings, this);
    testBackgroundVsSeparateSet(new MutualInformation(true, true), new MutualInformation(true, false));
    testBackgroundVsSeparateSet(new ChiSquare(true, true), new ChiSquare(true, false));
    testBackgroundVsSeparateSet(new GND(true), new GND(false));
}
Also used : ChiSquare(org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare) MutualInformation(org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation) GND(org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND)

Aggregations

ChiSquare (org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare)8 MutualInformation (org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation)7 GND (org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND)6 JLHScore (org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHScore)5 PercentageScore (org.elasticsearch.search.aggregations.bucket.significant.heuristics.PercentageScore)3 SignificanceHeuristic (org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic)2 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 BytesRef (org.apache.lucene.util.BytesRef)1 RegExp (org.apache.lucene.util.automaton.RegExp)1 SearchResponse (org.elasticsearch.action.search.SearchResponse)1 TermQueryBuilder (org.elasticsearch.index.query.TermQueryBuilder)1 Script (org.elasticsearch.script.Script)1 SearchModule (org.elasticsearch.search.SearchModule)1 SignificantTerms (org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms)1 SignificantTermsAggregationBuilder (org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder)1 ScriptHeuristic (org.elasticsearch.search.aggregations.bucket.significant.heuristics.ScriptHeuristic)1 SignificanceHeuristicParser (org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicParser)1 IncludeExclude (org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude)1 ElasticsearchAssertions.assertSearchResponse (org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse)1