I’m trying to add filter to query elastic search data, following example from https://www.yiiframework.com/extension/yiisoft/yii2-elasticsearch/doc/guide/2.1/en/usage-ar#complex-queries
$query = EsModel::find()->filter($filter)->addAggregate($agg);
$result = $query->search();
But getting error:
Exception ‘yii\base\UnknownMethodException’ with message ‘Calling unknown method: yii\elasticsearch\ActiveQuery::filter()’
Looking at API doc (https://www.yiiframework.com/extension/yiisoft/yii2-elasticsearch/doc/api/2.1/yii-elasticsearch-activequery) filter() doesn’t seem to be available.
What is the correct way to add filter to the query if this is not available?
Using “yiisoft/yii2-elasticsearch” : “~2.1.0” in composer.json.