diff --git a/Aggregation/TermsAggregationTest.php b/Aggregation/TermsAggregationTest.php index c1e5371ba1422d071f7eea6c22d23a83b46a5fcc..14565d5a814bfcc3b14f37b5f7baaae869b17866 100644 --- a/Aggregation/TermsAggregationTest.php +++ b/Aggregation/TermsAggregationTest.php @@ -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' => [