Hello,
I'm completely new with elasticsearch and don't have any experience with it yet, and now I'm evaluating if it can be part of a solution I'm creating, because I would like to use kibana.
I've a JMS Queue where events are being added by other system. I'm converting these events in JSON like below:
First question. Can I update this JSON record inside elasticsearch using as filter the parameter instanceId? Something like UPDATE set status='Running' where instanceId = 123 in SQL
Second question. The update action can occur in a really small period of time (miliseconds) and I'm not sure if this kind of action is safe in elasticsearch because in the article below I read:
Yes, _update_by_query does this. But it is a much "heavier" thing than doing an _update using the documents ID. You should prefer the _update API if possible.
Well, with _update it is quite safe. _update performs a realtime get, which, in 5.0, if the document hasn't been refreshed already, will force a refresh of the shard to make the change visible immediately and then update. Pre 5.0 it is actually more efficient because the refresh isn't required. The change in 5.0 was to enable some other optimizations for more common use cases.
With _update_by_query you'll get a version conflict and have to manually retry.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.