fullscale/elastic.js — pull request #42 by Murhaf (2013-11-07 15:36:12+00:00)
Title: added completion suggester and fuzzy completion suggester

As of today, elastic.js doesn't support completion suggester, which was added in elasticsearch-0.90.3 see [here](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html).

Supporting this functionality in elastic.js is pretty straightforward. Simply, I created [CompletionSuggester](https://github.com/Murhaf/elastic.js/blob/master/src/search/suggest/CompletionSuggester.js) and [FuzzyCompletionSuggester](https://github.com/Murhaf/elastic.js/blob/master/src/search/suggest/FuzzyCompletionSuggester.js) both of type _sugget and added a function named "doSuggest" in [Request.js](https://github.com/Murhaf/elastic.js/tree/master/src/search/Request.js#L874).
Fuzzy queries were added to CompletionSuggester in elasticsearch-0.90.4, hence the two types of completion suggester, viz. CompletionSuggester, which works with elasticsearch version 0.90.3 or higher, and FuzzyCompletionSuggester which works with version 0.90.4 or higher.

Please note that the _suggest endpoint is on the index level, not the type, which explains the changes in [Request.js](https://github.com/Murhaf/elastic.js/tree/master/src/search/Request.js#L32).

You can use the completion suggester as follows:

``` javascript
var myRequest = ejs.Request()
.indices('myIndex')
.types('myType')
.suggest(ejs.CompletionSuggester("suggestedTerms")
.field("suggest")
.text('something'));

suggestions = myRequest.doSuggest();
```

fixes #41