Custom routing and the update API

Hi, I'm pretty new to ElasticSearch and am starting to look into custom
routing. I'd like to use my user's usernames as the routing key, as a
frequent operation will be to find a particular user's content.

I'm sending the routing value along with each indexing call, and this is
all fine apart from the update API (my application lets users change their
username, so I need to be able to update all content with a certain
username). I can specify the routing key in the update call, however this
obviously finds the document to be updated, rather than letting me update
the routing.

Is there any way to update a document's routing value without deleting and
re-indexing manually? I understand that _update essentially reindexes the
document anyway, but doing so without resending the entire document would
be good.

Thanks for any pointers.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ddfaa9ec-7b9e-4ede-b2fc-9fd81c85fffc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Graham,
being the routing key the way to decide where the document gets indexed,
you need to delete the original document by specying the old routing key,
then reindex it with the new one, so that it will get indexed again, but
this time most likely in a different shard.

By the way, even using the update api with default routing, what happens
under the hood is a delete + index, just a bit more optimized as it happens
internally and you make a single http request, but that's exactly how
lucene works (no update at lucene level).

On Monday, February 17, 2014 12:11:47 AM UTC+1, Graham Bradley wrote:

Hi, I'm pretty new to Elasticsearch and am starting to look into custom
routing. I'd like to use my user's usernames as the routing key, as a
frequent operation will be to find a particular user's content.

I'm sending the routing value along with each indexing call, and this is
all fine apart from the update API (my application lets users change their
username, so I need to be able to update all content with a certain
username). I can specify the routing key in the update call, however this
obviously finds the document to be updated, rather than letting me update
the routing.

Is there any way to update a document's routing value without deleting and
re-indexing manually? I understand that _update essentially reindexes the
document anyway, but doing so without resending the entire document would
be good.

Thanks for any pointers.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/55d25dea-3ae2-43c4-8a19-9efa7aaa239f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Luca,

That's what I assumed, thanks for clarifying though. I'll need to decide if
its less work to occasionally re-index all the user's content, or just use
the user's (immutable) numeric ID and look this up prior to searching.

Thanks
Graham

On Monday, February 17, 2014 8:35:10 AM UTC, Luca Cavanna wrote:

Hi Graham,
being the routing key the way to decide where the document gets indexed,
you need to delete the original document by specying the old routing key,
then reindex it with the new one, so that it will get indexed again, but
this time most likely in a different shard.

By the way, even using the update api with default routing, what happens
under the hood is a delete + index, just a bit more optimized as it happens
internally and you make a single http request, but that's exactly how
lucene works (no update at lucene level).

On Monday, February 17, 2014 12:11:47 AM UTC+1, Graham Bradley wrote:

Hi, I'm pretty new to Elasticsearch and am starting to look into custom
routing. I'd like to use my user's usernames as the routing key, as a
frequent operation will be to find a particular user's content.

I'm sending the routing value along with each indexing call, and this is
all fine apart from the update API (my application lets users change their
username, so I need to be able to update all content with a certain
username). I can specify the routing key in the update call, however this
obviously finds the document to be updated, rather than letting me update
the routing.

Is there any way to update a document's routing value without deleting
and re-indexing manually? I understand that _update essentially reindexes
the document anyway, but doing so without resending the entire document
would be good.

Thanks for any pointers.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/71383259-3d5e-41ef-a63a-f40bb6cbed07%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.