Skip to content
Snippets Groups Projects
Commit 8443d2f2 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

Merge branch 'patch-terms-aggregation' of...

Merge branch 'patch-terms-aggregation' of https://github.com/chyzas/ElasticsearchBundle into chyzas-patch-terms-aggregation

# Conflicts:
#	DSL/Aggregation/TermsAggregation.php
parents 71886735 072aa9f9
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #1 terms aggregation with size.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setSize(1);
$aggregation->addParameter('size', 1);
$result = [
'agg_test_agg' => [
......@@ -79,8 +79,8 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #3 terms aggregation with size and min document count.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setSize(1);
$aggregation->setMinDocumentCount(10);
$aggregation->addParameter('size', 1);
$aggregation->addParameter('min_doc_count', 10);
$result = [
'agg_test_agg' => [
......@@ -103,8 +103,8 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #4 terms aggregation with simple include, exclude.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setInclude('test_.*');
$aggregation->setExclude('pizza_.*');
$aggregation->addParameter('include', 'test_.*');
$aggregation->addParameter('exclude', 'pizza_.*');
$result = [
'agg_test_agg' => [
......@@ -127,8 +127,20 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #5 terms aggregation with include, exclude and flags.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setInclude('test_.*', 'CANON_EQ|CASE_INSENSITIVE');
$aggregation->setExclude('pizza_.*', 'CASE_INSENSITIVE');
$aggregation->addParameter(
'include',
[
'pattern' => 'test_.*',
'flags' => 'CANON_EQ|CASE_INSENSITIVE',
]
);
$aggregation->addParameter(
'exclude',
[
'pattern' => 'pizza_.*',
'flags' => 'CASE_INSENSITIVE',
]
);
$result = [
'agg_test_agg' => [
......@@ -157,7 +169,7 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #6 terms aggregation with order default direction.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setOrder(TermsAggregation::MODE_COUNT);
$aggregation->addParameter('order', ['_count' => 'asc']);
$result = [
'agg_test_agg' => [
......@@ -179,7 +191,7 @@ class TermsAggregationTest extends \PHPUnit_Framework_TestCase
// Case #7 terms aggregation with order term mode, desc direction.
$aggregation = new TermsAggregation('test_agg');
$aggregation->setField('test_field');
$aggregation->setOrder(TermsAggregation::MODE_TERM, TermsAggregation::DIRECTION_DESC);
$aggregation->addParameter('order', ['_term' => 'desc']);
$result = [
'agg_test_agg' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment