{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/40","labels_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/40/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/40/events","html_url":"https://github.com/yiisoft/yii2-elasticsearch/issues/40","id":120646467,"number":40,"title":"Unexpected handling of and/or filter conditions","user":{"login":"beowulfenator","id":5413344,"avatar_url":"https://avatars.githubusercontent.com/u/5413344?v=3","gravatar_id":"","url":"https://api.github.com/users/beowulfenator","html_url":"https://github.com/beowulfenator","followers_url":"https://api.github.com/users/beowulfenator/followers","following_url":"https://api.github.com/users/beowulfenator/following{/other_user}","gists_url":"https://api.github.com/users/beowulfenator/gists{/gist_id}","starred_url":"https://api.github.com/users/beowulfenator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beowulfenator/subscriptions","organizations_url":"https://api.github.com/users/beowulfenator/orgs","repos_url":"https://api.github.com/users/beowulfenator/repos","events_url":"https://api.github.com/users/beowulfenator/events{/privacy}","received_events_url":"https://api.github.com/users/beowulfenator/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-06T17:17:49Z","updated_at":"2015-12-07T10:41:21Z","closed_at":"2015-12-07T10:41:21Z","body":"Adding several conditions using `orWhere` results in an unexpected query structure:\r\n\r\n    $query->where(['_id' => ['1']]);\r\n    $query->orWhere(['_id' => ['2']]);\r\n    $query->orWhere(['_id' => ['3']]);\r\n    $query->orWhere(['_id' => ['4']]);\r\n\r\nThis produces the following query structure:\r\n\r\n    {\r\n      \"filter\":{\r\n        \"or\":[{\r\n            \"or\":[{\r\n                \"or\":[\r\n                  {\"ids\":{\"values\":[\"1\"]}},\r\n                  {\"ids\":{\"values\":[\"2\"]}}\r\n                ]\r\n              },\r\n              {\"ids\":{\"values\":[\"3\"]}}\r\n            ]\r\n          },\r\n          {\"ids\":{\"values\":[\"4\"]}}\r\n        ]\r\n      }\r\n    }\r\n\r\nI would expect something like:\r\n\r\n    {\r\n      \"filter\":{\r\n        \"or\":[\r\n          {\"ids\":{\"values\":[\"1\"]}},\r\n          {\"ids\":{\"values\":[\"2\"]}},\r\n          {\"ids\":{\"values\":[\"3\"]}},\r\n          {\"ids\":{\"values\":[\"4\"]}}\r\n        ]\r\n      }\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/comments/162479147","html_url":"https://github.com/yiisoft/yii2-elasticsearch/issues/40#issuecomment-162479147","issue_url":"https://api.github.com/repos/yiisoft/yii2-elasticsearch/issues/40","id":162479147,"user":{"login":"beowulfenator","id":5413344,"avatar_url":"https://avatars.githubusercontent.com/u/5413344?v=3","gravatar_id":"","url":"https://api.github.com/users/beowulfenator","html_url":"https://github.com/beowulfenator","followers_url":"https://api.github.com/users/beowulfenator/followers","following_url":"https://api.github.com/users/beowulfenator/following{/other_user}","gists_url":"https://api.github.com/users/beowulfenator/gists{/gist_id}","starred_url":"https://api.github.com/users/beowulfenator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beowulfenator/subscriptions","organizations_url":"https://api.github.com/users/beowulfenator/orgs","repos_url":"https://api.github.com/users/beowulfenator/repos","events_url":"https://api.github.com/users/beowulfenator/events{/privacy}","received_events_url":"https://api.github.com/users/beowulfenator/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T10:41:21Z","updated_at":"2015-12-07T10:41:21Z","body":"Well, this definitely works. If this is the intended behavior, then never mind. Also, given that and/or/not are deprecated anyway, this is probably not important."}}