File tree 1 file changed +26
-1
lines changed
elasticsearch-persistence
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -602,7 +602,32 @@ puts results.response.aggregations.authors.buckets.each { |b| puts "#{b['key']}
602
602
# John : 1
603
603
```
604
604
605
- #### Accessing the Repository Gateway
605
+ #### The Elasticsearch Client
606
+
607
+ The module will set up a [ client] ( https://github.com/elasticsearch/elasticsearch-ruby/tree/master/elasticsearch ) ,
608
+ connected to ` localhost:9200 ` , by default.
609
+
610
+ To use a client with different configuration:
611
+
612
+ ``` ruby
613
+ Elasticsearch ::Persistence .client = Elasticsearch ::Client .new log: true
614
+ ```
615
+
616
+ To set up a specific client for a specific model:
617
+
618
+ ``` ruby
619
+ Article .client = Elasticsearch ::Client .new host: ' api.server.org'
620
+ ```
621
+
622
+ You might want to do this during you application bootstrap process, e.g. in a Rails initializer.
623
+
624
+ Please refer to the
625
+ [ ` elasticsearch-transport ` ] ( https://github.com/elasticsearch/elasticsearch-ruby/tree/master/elasticsearch-transport )
626
+ library documentation for all the configuration options, and to the
627
+ [ ` elasticsearch-api ` ] ( http://rubydoc.info/gems/elasticsearch-api ) library documentation
628
+ for information about the Ruby client API.
629
+
630
+ #### Accessing the Repository Gateway and the Client
606
631
607
632
The integration with Elasticsearch is implemented by embedding the repository object in the model.
608
633
You can access it through the ` gateway ` method:
You can’t perform that action at this time.
0 commit comments