-->

Update elasticsearch settings via Tire

2019-07-15 15:22发布

问题:

Is it possible to use Tire to update elasticsearch settings? I have this curl command I'd like to run automatically.

`curl -XPUT localhost:9200/tweets/_settings -d '{
      "index" : {
          "refresh_interval" : "-1"
      }
  }'`

The value is available via tire but I'm not sure how to apply it.

Tweet.tire.settings[:refresh_interval]

回答1:

Possible, but ugly :)

Tire::Configuration.client.put([Tire::Configuration.url, Tweet.index.name].join('/'),
                               index: { refresh_interval: '-1' })

Will get nicer in future versions...