Secondary index in riak
Hi all, I'm getting into a scenario where I'd like to use a secondary index on a particular field in my riak object/data. However the value of the field might change albeit very very rarely. So I was thinking I could just reindex using the new value. What's the right syntax to delete and add a new secondary index? A map-reduce approach would be great. I wouldn't mind a better alternative though. Thanks in advance PS: I am using riak with node.js (riakjs) Jose ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Secondary index in riak
Thanks to all. I'll take that option. Will let you guys know if I get any strange behavior. Sent from my iPad > On Feb 19, 2015, at 4:50 PM, Christopher Meiklejohn > wrote: > > >> On Feb 19, 2015, at 9:47 AM, Daniel Iwan wrote: >> >> My ideas: >> 1. Rewrite (read-write) object with new values for all indexes >> 2. Enable siblings on a bucket, write empty object with update for your >> index, that will create sibling. >> Then whenever you read object do merge of object+indexes. This may be more >> appropriate if you have big objects and want to "save" bandwidth >> >> Option 1 is definitely simpler though. > > Option 1 is the safest, least error-prone method for performing this. > > - Chris > > Christopher Meiklejohn > Senior Software Engineer > Basho Technologies, Inc. > cmeiklej...@basho.com > > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: [Announcement] Official Riak Node.js client released.
Dear Brian, Thank you very much for sharing this link. I have been looking for a riak client for node.js that is compatible with riak 2.0. However, having glanced at it I noticed that there was no method to access the meta information. This is good for link manipulation, for example. As well in order to update an object the meta information could be useful. As a disclaimer here, I should mention that I have been using riak-js to access riak 1.4. Now I'd like to transition to riak 2.0 and I am looking for the right tools. Overall, where can one find more documentation and more concrete examples about how to manipulate riak with this client. Thanks & regards, Jose Sent from my iPad > On Apr 2, 2015, at 2:36 AM, Brian Roach wrote: > > Greetings Riak Users! > > Today we released the official Node.js client for Riak. > > It's available via npm: > > https://www.npmjs.com/package/basho-riak-client > > The github repo can be found here: > > https://github.com/basho/riak-nodejs-client > > API docs are published here: > > http://basho.github.io/riak-nodejs-client/classes/Client.html > > Thanks! > - Brian Roach > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Object metadata via NodeJS client
Thanks a bunch Luke. It's now getting clear. However the links manipulation is not available yet on the API docs. I guess it's just a matter of update. I will now start re implementing my riak data access with this client. When I get questions I will turn to you guys. Regards Jose Sent from my iPad > On Apr 7, 2015, at 6:50 PM, Luke Bakken wrote: > > Hi José, > > Please refer to this document: > > http://basho.github.io/riak-nodejs-client/classes/RiakObject.html > > When you retrieve a value, you get a RiakObject back: > > client.fetchValue({ bucket: 'test', key: 'foo' }, function (err, rslt) { >var riakObj = rslt.values.shift(); > }); > > This RiakObject exposes several methods related to metadata. > > I just released version 1.1.0 which adds support for links. You'll see > that in the API docs now. > > -- > Luke Bakken > Engineer > lbak...@basho.com > > > On Tue, Apr 7, 2015 at 5:27 AM, José Ghislain Quenum > wrote: >> Luke, >> In my current implementation, I use metadata for both links and secondary >> index. >> >>> On Mon, Apr 6, 2015 at 4:03 PM, Luke Bakken wrote: >>> >>> Hi José, >>> >>> Other than links, what object metadata are you trying to access or modify? >>> >>> Thanks - >>> >>> -- >>> Luke Bakken >>> Engineer >>> lbak...@basho.com >>> >>> >>> On Sat, Apr 4, 2015 at 6:56 AM, José Ghislain Quenum >>> wrote: Thanks Brian for your reply and trying to work out the links part. I took a look at the RiakObject and could see how to manipulate it with FetchValue and the Secondary Index. However, I failed to figure out how to access the meta while reading an object. Just as an example, when you're updating an object you could be using some meta data, and some of them come from a prior read. If you could just share some examples with code that'd be very helpful. Thanks José >> >> ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Object metadata via NodeJS client
Alright cool! Thanks a bunch Sent from my iPad > On Apr 8, 2015, at 9:20 PM, Luke Bakken wrote: > > José, > > Check out the following methods in the document: > > http://basho.github.io/riak-nodejs-client/classes/RiakObject.html > > hasLinks() > getLinks() > setLinks() > > -- > Luke Bakken > Engineer > lbak...@basho.com > > > On Wed, Apr 8, 2015 at 8:56 AM, Jose G. Quenum > wrote: >> Thanks a bunch Luke. It's now getting clear. However the links manipulation >> is not available yet on the API docs. I guess it's just a matter of update. >> I will now start re implementing my riak data access with this client. When >> I get questions I will turn to you guys. >> Regards >> Jose >> >> Sent from my iPad >> >>> On Apr 7, 2015, at 6:50 PM, Luke Bakken wrote: >>> >>> Hi José, >>> >>> Please refer to this document: >>> >>> http://basho.github.io/riak-nodejs-client/classes/RiakObject.html >>> >>> When you retrieve a value, you get a RiakObject back: >>> >>> client.fetchValue({ bucket: 'test', key: 'foo' }, function (err, rslt) { >>> var riakObj = rslt.values.shift(); >>> }); >>> >>> This RiakObject exposes several methods related to metadata. >>> >>> I just released version 1.1.0 which adds support for links. You'll see >>> that in the API docs now. >>> >>> -- >>> Luke Bakken >>> Engineer >>> lbak...@basho.com >>> >>> >>> On Tue, Apr 7, 2015 at 5:27 AM, José Ghislain Quenum >>> wrote: >>>> Luke, >>>> In my current implementation, I use metadata for both links and secondary >>>> index. >>>> >>>>> On Mon, Apr 6, 2015 at 4:03 PM, Luke Bakken wrote: >>>>> >>>>> Hi José, >>>>> >>>>> Other than links, what object metadata are you trying to access or modify? >>>>> >>>>> Thanks - >>>>> >>>>> -- >>>>> Luke Bakken >>>>> Engineer >>>>> lbak...@basho.com >>>>> >>>>> >>>>> On Sat, Apr 4, 2015 at 6:56 AM, José Ghislain Quenum >>>>> wrote: >>>>>> Thanks Brian for your reply and trying to work out the links part. I >>>>>> took a look at the RiakObject and could see how to manipulate it with >>>>>> FetchValue and the Secondary Index. However, I failed to figure out >>>>>> how to access the meta while reading an object. Just as an example, >>>>>> when you're updating an object you could be using some meta data, and >>>>>> some of them come from a prior read. >>>>>> >>>>>> If you could just share some examples with code that'd be very helpful. >>>>>> >>>>>> Thanks José >>>> >>>> ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Object metadata via NodeJS client
Hi Luke, It looks like my previous email didn't get through. I have a few questions regarding the riak client. 1 - when I have several indices to add to an object can I just chain them to the riakObject, ie, call successive addIndex methods to a riakObject? 2 - when I am doing a map-reduce, a - can I use key filters? What's the syntax? b - how can I use map reduce to walk links? In riak-js I used to specify the links in the inputs. What is the syntax with this client? Thanks in advance Jose Sent from my iPad > On Apr 8, 2015, at 9:20 PM, Luke Bakken wrote: > > José, > > Check out the following methods in the document: > > http://basho.github.io/riak-nodejs-client/classes/RiakObject.html > > hasLinks() > getLinks() > setLinks() > > -- > Luke Bakken > Engineer > lbak...@basho.com > > > On Wed, Apr 8, 2015 at 8:56 AM, Jose G. Quenum > wrote: >> Thanks a bunch Luke. It's now getting clear. However the links manipulation >> is not available yet on the API docs. I guess it's just a matter of update. >> I will now start re implementing my riak data access with this client. When >> I get questions I will turn to you guys. >> Regards >> Jose >> >> Sent from my iPad >> >>> On Apr 7, 2015, at 6:50 PM, Luke Bakken wrote: >>> >>> Hi José, >>> >>> Please refer to this document: >>> >>> http://basho.github.io/riak-nodejs-client/classes/RiakObject.html >>> >>> When you retrieve a value, you get a RiakObject back: >>> >>> client.fetchValue({ bucket: 'test', key: 'foo' }, function (err, rslt) { >>> var riakObj = rslt.values.shift(); >>> }); >>> >>> This RiakObject exposes several methods related to metadata. >>> >>> I just released version 1.1.0 which adds support for links. You'll see >>> that in the API docs now. >>> >>> -- >>> Luke Bakken >>> Engineer >>> lbak...@basho.com >>> >>> >>> On Tue, Apr 7, 2015 at 5:27 AM, José Ghislain Quenum >>> wrote: >>>> Luke, >>>> In my current implementation, I use metadata for both links and secondary >>>> index. >>>> >>>>> On Mon, Apr 6, 2015 at 4:03 PM, Luke Bakken wrote: >>>>> >>>>> Hi José, >>>>> >>>>> Other than links, what object metadata are you trying to access or modify? >>>>> >>>>> Thanks - >>>>> >>>>> -- >>>>> Luke Bakken >>>>> Engineer >>>>> lbak...@basho.com >>>>> >>>>> >>>>> On Sat, Apr 4, 2015 at 6:56 AM, José Ghislain Quenum >>>>> wrote: >>>>>> Thanks Brian for your reply and trying to work out the links part. I >>>>>> took a look at the RiakObject and could see how to manipulate it with >>>>>> FetchValue and the Secondary Index. However, I failed to figure out >>>>>> how to access the meta while reading an object. Just as an example, >>>>>> when you're updating an object you could be using some meta data, and >>>>>> some of them come from a prior read. >>>>>> >>>>>> If you could just share some examples with code that'd be very helpful. >>>>>> >>>>>> Thanks José >>>> >>>> ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Node.js client addIndex() and map/reduce questions (Was: Object metadata via NodeJS client)
Thanks! Will peruse through these links Sent from my iPad On Apr 17, 2015, at 7:15 PM, Luke Bakken wrote: >> 1 - when I have several indices to add to an object can I just chain them to >> the riakObject, ie, call successive addIndex methods to a riakObject? > > Source code is available as part of the API docs. Note that "this" is > returned, which allows chaining: > > http://basho.github.io/riak-nodejs-client/files/lib_commands_kv_riakobject.js.html#l230 > >> 2 - when I am doing a map-reduce, >> a - can I use key filters? What's the syntax? >> b - how can I use map reduce to walk links? In riak-js I used to >> specify the links in the inputs. What is the syntax with this client? > > I am not an expert with map/reduce, but did find the following documents: > > http://docs.basho.com/riak/latest/dev/using/keyfilters/ > > http://docs.basho.com/riak/latest/dev/using/link-walking/ (Note > deprecation notice) > > -- > Luke Bakken > Engineer > lbak...@basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com