I'm a newbie to Riak and I'm trying to get Riak Search up and running but so far I'm failing miserably. I've listed the steps I tried below, please advise as to what I'm missing.
1) Create Index:
curl -X PUT http://192.168.189.153:10018/search/index/ix1 \
-H 'Content-Type: application/json' \
-d '{"schema":"_yz_default"}'
2) Create and activate index
riak-admin bucket-type create citytype '{"props":{"search_index":"ix1"}}'
riak-admin bucket-type activate citytype
4) Create using Ruby
require 'riak'
client = Riak::Client.new(:nodes => [
{:host => "192.168.189.153", :pb_port => 10017},
{:host => "192.168.189.153", :pb_port => 10027},
{:host => "192.168.189.153", :pb_port => 10037}
])
city = {
:name => 'Roskilde',
:countrycode => 'DK',
:location => '1.2',
:population => 80000
}
city_bucket = client.bucket_type('citytype').bucket('byer')
new_city = city_bucket.get_or_new(city[:name])
new_city.data = city
new_city.store(w: 3, dw: 2)
5) Retrieve Using Ruby
require 'riak'
client = Riak::Client.new(:nodes => [
{:host => "192.168.189.153", :pb_port => 10017}
])
city_bucket = client.bucket_type('citytype').bucket('byer')
fetched = city_bucket.get('Roskilde')
p fetched
results = client.search("ix1", "name:Roskilde")
p results
p results['docs']
6) Output
ruby search1.rb
#<Riak::RObject {byer,Roskilde} [#<Riak::RContent [application/json]:{"name"=>"Roskilde", "countrycode"=>"DK", "location"=>"1.2", "population"=>80000}>]>
{"max_score"=>0.0, "num_found"=>0, "docs"=>[]}
[]
7) Via HTTP
http://192.168.189.153:10018/types/citytype/buckets/byer/keys/Roskilde
{"name":"Roskilde","countrycode":"DK","location":"1.2","population":80000}
http://192.168.189.153:10018/search/query/ix1?wt=json&q=name:Roskilde
{"responseHeader":{"status":0,"QTime":10,"params":{"192.168.189.153:10034":"_yz_pn:51 OR _yz_pn:39 OR _yz_pn:36 OR _yz_pn:27 OR _yz_pn:24 OR _yz_pn:12","shards":"192.168.189.153:10014/internal_solr/ix1,192.168.189.153:10024/internal_solr/ix1,192.168.189.153:10034/internal_solr/ix1","q":"name:Roskilde","wt":"json","192.168.189.153:10014":"_yz_pn:64 OR (_yz_pn:61 AND (_yz_fpn:61)) OR _yz_pn:60 OR _yz_pn:57 OR _yz_pn:48 OR _yz_pn:45 OR _yz_pn:33 OR _yz_pn:21 OR _yz_pn:9","192.168.189.153:10024":"_yz_pn:54 OR _yz_pn:42 OR _yz_pn:30 OR _yz_pn:18 OR _yz_pn:15 OR _yz_pn:6 OR _yz_pn:3"}},"response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]}}
8) Error Logs
The solr.log
file has only explainable errors (cases where I, out of desperation did some weird wildcard searching)
The error.log
file show a number of errors like this, but none from a set of recent new tests:
23:15:41.308 [error] Error in process <0.4385.0> on node 'dev1@192.168.189.153' with exit value: {{badmatch,['dev3@192.168.189.153']},[{yz_index,wait_for_index,3,[{file,"src/yz_index.erl"},{line,415}]}]}
9) Versions
karsten@ubuntu:~/riak$ dev/dev1/bin/riak-admin status | grep riak_kv_version
riak_kv_version : <<"2.0.2-99-g404619c">>
karsten@ubuntu:~/riak$
karsten@ubuntu:~/riak$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
karsten@ubuntu:~/riak$