{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4709","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4709/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4709/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4709/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/4709","id":101651426,"number":4709,"title":"Filtering by secondary index between another index","user":{"login":"JohnyDays","id":4540763,"avatar_url":"https://avatars.githubusercontent.com/u/4540763?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnyDays","html_url":"https://github.com/JohnyDays","followers_url":"https://api.github.com/users/JohnyDays/followers","following_url":"https://api.github.com/users/JohnyDays/following{/other_user}","gists_url":"https://api.github.com/users/JohnyDays/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnyDays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnyDays/subscriptions","organizations_url":"https://api.github.com/users/JohnyDays/orgs","repos_url":"https://api.github.com/users/JohnyDays/repos","events_url":"https://api.github.com/users/JohnyDays/events{/privacy}","received_events_url":"https://api.github.com/users/JohnyDays/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/19","html_url":"https://github.com/rethinkdb/rethinkdb/milestones/notabug","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/19/labels","id":299349,"number":19,"title":"notabug","description":"It's a feature. The issue describes a RethinkDB feature or design choice as if it was a bug.","creator":{"login":"AtnNn","id":706854,"avatar_url":"https://avatars.githubusercontent.com/u/706854?v=3","gravatar_id":"","url":"https://api.github.com/users/AtnNn","html_url":"https://github.com/AtnNn","followers_url":"https://api.github.com/users/AtnNn/followers","following_url":"https://api.github.com/users/AtnNn/following{/other_user}","gists_url":"https://api.github.com/users/AtnNn/gists{/gist_id}","starred_url":"https://api.github.com/users/AtnNn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AtnNn/subscriptions","organizations_url":"https://api.github.com/users/AtnNn/orgs","repos_url":"https://api.github.com/users/AtnNn/repos","events_url":"https://api.github.com/users/AtnNn/events{/privacy}","received_events_url":"https://api.github.com/users/AtnNn/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":104,"state":"closed","created_at":"2013-03-29T21:07:05Z","updated_at":"2015-08-18T20:45:31Z","due_on":null,"closed_at":"2013-05-13T23:08:44Z"},"comments":5,"created_at":"2015-08-18T13:09:04Z","updated_at":"2015-08-19T00:15:12Z","closed_at":"2015-08-18T20:45:26Z","body":"# Scenario: \r\n- I have an event table, which is a log of events.\r\n- This table has an index userId (string)\r\n- This table has an index timestamp (date)\r\n- I want to get all events for the user 4 from the last 2 days\r\n\r\n# My expected solution:\r\n```javascript\r\nr.table('events')\r\n  .between(r.now().sub(25600), r.now(), {index: 'timestamp'})\r\n  .getAll('4', {index: 'residentId'})\r\n```\r\nor \r\n```javascript\r\nr.table('events')\r\n  .getAll('4', {index: 'residentId'})\r\n  .between(r.now().sub(25600), r.now(), {index: 'timestamp'})\r\n```\r\n\r\nNeither work, is there an alternative way to do this? Am I missing something obvious?"},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/132400423","html_url":"https://github.com/rethinkdb/rethinkdb/issues/4709#issuecomment-132400423","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4709","id":132400423,"user":{"login":"JohnyDays","id":4540763,"avatar_url":"https://avatars.githubusercontent.com/u/4540763?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnyDays","html_url":"https://github.com/JohnyDays","followers_url":"https://api.github.com/users/JohnyDays/followers","following_url":"https://api.github.com/users/JohnyDays/following{/other_user}","gists_url":"https://api.github.com/users/JohnyDays/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnyDays/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnyDays/subscriptions","organizations_url":"https://api.github.com/users/JohnyDays/orgs","repos_url":"https://api.github.com/users/JohnyDays/repos","events_url":"https://api.github.com/users/JohnyDays/events{/privacy}","received_events_url":"https://api.github.com/users/JohnyDays/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T00:15:11Z","updated_at":"2015-08-19T00:15:11Z","body":"Probably as an example of a use for compound indexes? That is if you believe it is a common use case, filtering by one field and ordering by another,"}}