toyama0919 / ej

Very few typing Elasticsearch Client
MIT License
31 stars 3 forks source link

Using ejrc file #1

Open clrh opened 6 years ago

clrh commented 6 years ago

Hi,

I would like to use the config file, but I am not sure to do it well.

$ cat ~/.ejrc 
default:
  host: elastic
  port: 80
  user: elastic
  password: elastic
  index: biblios
user@lab:~/cli/es-cli$ ej settings
/usr/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect': Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "localhost" port 9200) (Faraday::ConnectionFailed)
        from /usr/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
        from /usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
        from /usr/lib/ruby/2.3.0/net/http.rb:878:in `connect'
        from /usr/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
        from /usr/lib/ruby/2.3.0/net/http.rb:852:in `start'
        from /usr/lib/ruby/2.3.0/net/http.rb:1384:in `request'
        from /usr/lib/ruby/2.3.0/net/http.rb:1142:in `get'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/adapter/net_http.rb:78:in `perform_request'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/adapter/net_http.rb:38:in `block in call'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/adapter/net_http.rb:85:in `with_net_http_connection'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/adapter/net_http.rb:33:in `call'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/request/url_encoded.rb:15:in `call'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/rack_builder.rb:143:in `build_response'
        from /var/lib/gems/2.3.0/gems/faraday-0.14.0/lib/faraday/connection.rb:387:in `run_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-transport-6.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-transport-6.0.1/lib/elasticsearch/transport/transport/base.rb:262:in `perform_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-transport-6.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-transport-6.0.1/lib/elasticsearch/transport/client.rb:131:in `perform_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-api-6.0.1/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
        from /var/lib/gems/2.3.0/gems/elasticsearch-api-6.0.1/lib/elasticsearch/api/actions/indices/get_settings.rb:65:in `get_settings'
        from /var/lib/gems/2.3.0/gems/ej-0.2.0/lib/ej/indices.rb:78:in `settings'
        from /var/lib/gems/2.3.0/gems/ej-0.2.0/lib/ej/commands.rb:229:in `settings'
        from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
        from /var/lib/gems/2.3.0/gems/ej-0.2.0/bin/ej:4:in `<top (required)>'
        from /usr/local/bin/ej:23:in `load'
        from /usr/local/bin/ej:23:in `<main>'
user@lab:~/cli/es-cli$ ej settings --index=biblios --host elastic6:80 --user=elastic --password=elastic
{
  ".triggered_watches": {
    "settings": {
      "index": {
...

The config file seems not read ?

Thanks.

toyama0919 commented 6 years ago

ej setttings is elasticsearch settings api. not local settings.

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html

toyama0919 commented 6 years ago

But interesting .ejrc. I want pull request 👍