{"issue":{"title":"Query DSL: Add different execution models for terms filter","created_at":"2011-12-23T22:29:38Z","user":{"login":"kimchy","id":41300,"url":"https://api.github.com/users/kimchy","gravatar_id":"fd44bb3c96e34e000c5453a0078900d6","avatar_url":"https://secure.gravatar.com/avatar/fd44bb3c96e34e000c5453a0078900d6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"milestone":null,"labels":[{"name":"enhancement","url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels/enhancement","color":"4a4ea8"},{"name":"v0.19.0","url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels/v0.19.0","color":"DDDDDD"}],"updated_at":"2011-12-23T22:29:38Z","state":"open","id":2650709,"closed_at":null,"html_url":"https://github.com/elasticsearch/elasticsearch/issues/1568","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"The way `terms` filter currently executes is by iterating over the terms provided and finding matches docs (loading into a bitset) and caching it. Sometimes, we want a different execution model that can still be achieved by building more complex queries in the DSL, but would be nice to support them in the more compact model that `terms` filter provides.\r\n\r\nThe `execution` option now has the following options :\r\n\r\n* `plain`: The default. Works as today. Iterates over all the terms, building a bit set matching it, and filtering. The total filter is cached (keyed by the terms).\r\n* `bool`: Builds a `bool` filter wrapping each term in a `term` filter that is cached. The bool filter is optimized in this case since it bitwise or's the different term filter bitsets. The total filter is not cached by default in this case.\r\n* `and`: Builds an `and` filter wrapping each term in `term` filter that is cached. The total filter is not cached by default in this case. Most times, `bool` should be used as its faster thanks to its bitwise execution.\r\n\r\nThe \"total\" terms filter caching can still be explicitly controlled using the `_cache` option. Note the default value for it depends on the `execution` value.","number":1568,"url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/1568","comments":0,"assignee":null},"action":"opened"}