Mat777
Mat777

Reputation: 338

Syntax error with rubygem elasticsearch

I have a problem using the rubygem for elasticsearch
When I try to execute the following code :

#!/usr/bin/env ruby

require 'rubygems'
require 'elasticsearch'

client = Elasticsearch::Client.new log: true

I get the following error :

syntax error, unexpected ':', expecting $end
client = Elasticsearch::Client.new log: true
                                       ^

Any ideas about this ?

Thanks

Upvotes: 0

Views: 87

Answers (1)

Marek Lipka
Marek Lipka

Reputation: 51171

You seem to use Ruby prior to 1.9 version. If so, either update Ruby (which is recommended), or use old rocket-hash syntax:

client = Elasticsearch.new :log => true

Upvotes: 1

Related Questions