简体   繁体   中英

How to issue a Riak Search query?

I've been using Riak for about a month now, and I just found out about Riak search. So I installed it, and inserted a very basic json document to test.

Here is the command i used:

curl -X PUT http://127.0.0.1:8098/riak/json/test -H "Content-Type: application/json" -d @test.json

where test.json is...

{
     "firstName": "John",
     "lastName": "Smith"    
 }

So according to https://wiki.basho.com/display/RIAK/Riak+Search+-+Indexing+and+Querying+Riak+KV+Data if i enabled KV searching on this bucket, then when i insert json document, the keys are automatically indexed.

I tried to do a search by using the search utility. i tried

/search-cmd search firstName "John"
/search-cmd search "firstName:John"

i even tried a curl cmd.

http://127.0.0.1:8098/solr/json/select?q=firstName:John

but i'm getting 0 results for all of them. what exactly am i doing wrong?

Your search command needs to be scoped to the "json" index since that's where the document you submitted will be indexed (the Riak Search / KV integration uses the bucket name as the index name). Make sure you install the indexing hook before you insert the document.

Try:

search-cmd search json firstName:John

For a more rapid reply to your question, join the riak-users mailing list at lists.basho.com .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM