Last active
August 29, 2015 14:10
-
-
Save takezoe/689fd8ec21d0de43f60d to your computer and use it in GitHub Desktop.
Experimental implementation of Elasticsearch4s Async API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /////////////////////////////////////////////////////////////// | |
| // Elasticsearch4s is a Scala client for Elasticsearch | |
| // https://github.com/bizreach/elasticsearch4s | |
| /////////////////////////////////////////////////////////////// | |
| val config = ESConfig("my_index", "my_type") | |
| // Use AsyncESClient instead of ESClient | |
| AsyncESClient.using("http://localhost:9200"){ client => | |
| val future = client.searchAsync(config){ searcher => | |
| searcher.setQuery(QueryBuilders.matchPhraseQuery("subject", "Hello")) | |
| } | |
| future.foreach { map => | |
| println(map) | |
| } | |
| } | |
| // Shutdown AsyncHttpClient | |
| AsyncESClient.shutdown() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment