Yii2-elasticsearch 2.1.0 ES 7


(Przeqpiciel+Yii) #1

Hi,
For last 3 days I’m trying to use YII2 extensions to get data from ES. I could get all data but when i try write simple function

public function getServiceLevel(){
    return $this->find()
        ->where([
            'EventName' => 'QueueParams'
        ])
        ->all();
}

I get this error

yii\elasticsearch\Exception: Elasticsearch request failed with code 400. in /var/www/devami/vendor/yiisoft/yii2-elasticsearch/Connection.php:549
Stack trace:
#0 /var/www/devami/vendor/yiisoft/yii2-elasticsearch/Connection.php(302): yii\elasticsearch\Connection->httpRequest('GET', 'http://10.0.248...', '{"size":10,"que...', false)
#1 /var/www/devami/vendor/yiisoft/yii2-elasticsearch/Command.php(68): yii\elasticsearch\Connection->get(Array, Array, '{"size":10,"que...')
#2 /var/www/devami/vendor/yiisoft/yii2-elasticsearch/Query.php(220): yii\elasticsearch\Command->search()
#3 /var/www/devami/vendor/yiisoft/yii2-elasticsearch/ActiveQuery.php(165): yii\elasticsearch\Query->all(NULL)
#4 /var/www/devami/models/Statistic.php(40): yii\elasticsearch\ActiveQuery->all()
#5 /var/www/devami/controllers/StatisticController.php(12): app\models\Statistic->getServiceLevel()
#6 [internal function]: app\controllers\StatisticController->actionIndex()
#7 /var/www/devami/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#8 /var/www/devami/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#9 /var/www/devami/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('', Array)
#10 /var/www/devami/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('statistic', Array)
#11 /var/www/devami/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#12 /var/www/devami/web/index.php(12): yii\base\Application->run()
#13 {main}
Additional Information:
Array
(
    [requestMethod] => GET
    [requestUrl] => http://10.0.248.244:9200/mini411/event/_search
    [requestBody] => {"size":10,"query":{"match_all":{}},"filter":{"term":{"EventName":"QueueParams"}}}
    [responseCode] => 400
    [responseHeaders] => Array
        (
            [content-type] => application/json; charset=UTF-8
            [content-length] => 241
        )

    [responseBody] => Array
        (
            [error] => Array
                (
                    [root_cause] => Array
                        (
                            [0] => Array
                                (
                                    [type] => parsing_exception
                                    [reason] => Unknown key for a START_OBJECT in [filter].
                                    [line] => 1
                                    [col] => 46
                                )

                        )

                    [type] => parsing_exception
                    [reason] => Unknown key for a START_OBJECT in [filter].
                    [line] => 1
                    [col] => 46
                )

            [status] => 400
        )

)