Is it possible to do an insert if the document/data doesn't exist and on exist just update it?
Exactly as the mongodb upsert feature.
Ref: http://www.mongodb.org/display/DOCS/Updating#Updating-{{upserts}}
That's exactly what ES does when you send a document.
Le 3 juin 2012 à 13:06, "Mr.Johnsson" c.johnsson@wocodi.com a écrit :
Is it possible to do an insert if the document/data doesn't exist and on
exist just update it?
Exactly as the mongodb upsert feature.
Ref: http://www.mongodb.org/display/DOCS/Updating#Updating-{{upserts}}--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Does-something-like-upsert-exist-in-ES-tp4018743.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.
Is it possible then to increment/change something if it exists and if not it defaults to something else?
For example..
inserting....
id : test,
count : 1
If next insert is 'id: test' it should set the counter to 2 and so on... if test gets deleted next insert should be 1 and then start counting up again. Exactly as mongos upsert. So far i can't figure this one out
if test already exist i can throw an update and the count works good but if it doesn't exist i get "document missing" so it doesn't create it. This means that i first have to check if 'test' exist in ES from my code then update it if exist or insert new if not.
Or am i missing something here
Hey have you considered using _version?
On Sunday, June 3, 2012, Mr.Johnsson wrote:
Is it possible then to increment/change something if it exists and if not
it
defaults to something else?
For example..inserting....
id : test,
count : 1If next insert is 'id: test' it should set the counter to 2 and so on... if
test gets deleted next insert should be 1 and then start counting up again.
Exactly as mongos upsert. So far i can't figure this one outif test already exist i can throw an update and the count works good but if
it doesn't exist i get "document missing" so it doesn't create it. This
means that i first have to check if 'test' exist in ES from my code then
update it if exist or insert new if not.Or am i missing something here
--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Does-something-like-upsert-exist-in-ES-tp4018743p4018745.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.
--
Benjamin DEVEZE
The feature make sense, opened an issue:
Update API: Allow to upsert, provide a doc and index it if the doc does not exists · Issue #2008 · elastic/elasticsearch · GitHub.
On Sun, Jun 3, 2012 at 2:08 PM, Mr.Johnsson c.johnsson@wocodi.com wrote:
Is it possible then to increment/change something if it exists and if not
it
defaults to something else?
For example..inserting....
id : test,
count : 1If next insert is 'id: test' it should set the counter to 2 and so on... if
test gets deleted next insert should be 1 and then start counting up again.
Exactly as mongos upsert. So far i can't figure this one outif test already exist i can throw an update and the count works good but if
it doesn't exist i get "document missing" so it doesn't create it. This
means that i first have to check if 'test' exist in ES from my code then
update it if exist or insert new if not.Or am i missing something here
--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Does-something-like-upsert-exist-in-ES-tp4018743p4018745.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.