Skip to content
Snippets Groups Projects
Unverified Commit 1a7701f5 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

add moving function aggregation

parent b732c8cb
No related branches found
No related tags found
No related merge requests found
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline;
/**
* Class representing Max Bucket Pipeline Aggregation.
*
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-movfn-aggregation.html
*/
class MovingFunctionAggregation extends AbstractPipelineAggregation
{
/**
* {@inheritdoc}
*/
public function getType()
{
return 'moving_fn';
}
}
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
use ONGR\ElasticsearchDSL\Aggregation\Pipeline\MovingFunctionAggregation;
/**
* Unit test for sum bucket aggregation.
*/
class MovingFunctionAggregationTest extends \PHPUnit\Framework\TestCase
{
/**
* Tests toArray method.
*/
public function testToArray()
{
$aggregation = new MovingFunctionAggregation('acme', 'test');
$expected = [
'moving_fn' => [
'buckets_path' => 'test',
],
];
$this->assertEquals($expected, $aggregation->toArray());
}
}
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