I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the documents at
http://www.elasticsearch.org/guide/reference/api/update.html and yet it
doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the documents at
Elasticsearch Platform — Find real-time answers at scale | Elastic and yet it
doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
Hi Igor,
I specified the request as followed:
curl -XPOST
'localhost:9200/prototype_2013.01.03/chow-clfg/YCKJVCgzQM2z8V663Zu0Ag/_update?parent=chow-demo'
-d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
and I still received the DocumentMissingException though, even when I could
search for the exact document.
Jonathan
On Wednesday, 2 January 2013 21:03:24 UTC+8, Igor Motov wrote:
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the documents
at Elasticsearch Platform — Find real-time answers at scale | Elastic and yet
it doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
Can you provide a full repro? It seems to work for me:
chow-demo.sh · GitHub
On Wednesday, January 2, 2013 9:25:03 PM UTC-5, Jonathan Moo wrote:
Hi Igor,
I specified the request as followed:
curl -XPOST
'localhost:9200/prototype_2013.01.03/chow-clfg/YCKJVCgzQM2z8V663Zu0Ag/_update?parent=chow-demo'
-d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
and I still received the DocumentMissingException though, even when I
could search for the exact document.
Jonathan
On Wednesday, 2 January 2013 21:03:24 UTC+8, Igor Motov wrote:
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the documents
at Elasticsearch Platform — Find real-time answers at scale | Elastic and yet
it doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
Thanks Imotov, you are right; it works when I follow your example.
Initially it couldn't work because I thought I could do *
ctx._source.chow-clfg.count+=num* instead of *
ctx._source["chow-clfg"].count+=num*.
I just realized it still doesn't work for me when I am using Nodejs to run
and somehow the JSON parser can't seem to parse the backslashes properly.
Any advice on this?
gistfile1.js
var options = {
host: 'localhost',
port: '9200',
path: 'prototype_2013.01.03/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update?parent=chow-demo',
method: 'POST'
};
var script = 'ctx._source[\"chow-clfg\"].count+=num';
var data = '{"script":"'+script+'","params":{"num":1}}';
data = JSON.parse(data);
This file has been truncated. show original
Regards,
Jonathan
On Thursday, 3 January 2013 10:53:04 UTC+8, Igor Motov wrote:
Can you provide a full repro? It seems to work for me:
chow-demo.sh · GitHub
On Wednesday, January 2, 2013 9:25:03 PM UTC-5, Jonathan Moo wrote:
Hi Igor,
I specified the request as followed:
curl -XPOST
'localhost:9200/prototype_2013.01.03/chow-clfg/YCKJVCgzQM2z8V663Zu0Ag/_update?parent=chow-demo'
-d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
and I still received the DocumentMissingException though, even when I
could search for the exact document.
Jonathan
On Wednesday, 2 January 2013 21:03:24 UTC+8, Igor Motov wrote:
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the documents
at Elasticsearch Platform — Find real-time answers at scale | Elastic and
yet it doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
I would try something like var script =
'ctx._source[\"chow-clfg\"].count+=num';
On Wednesday, January 2, 2013 11:11:38 PM UTC-5, Jonathan Moo wrote:
Thanks Imotov, you are right; it works when I follow your example.
Initially it couldn't work because I thought I could do *
ctx._source.chow-clfg.count+=num* instead of *
ctx._source["chow-clfg"].count+=num*.
I just realized it still doesn't work for me when I am using Nodejs to run
and somehow the JSON parser can't seem to parse the backslashes properly.
Any advice on this?
Error in updating an existing document field count in Elasticsearch · GitHub
Regards,
Jonathan
On Thursday, 3 January 2013 10:53:04 UTC+8, Igor Motov wrote:
Can you provide a full repro? It seems to work for me:
chow-demo.sh · GitHub
On Wednesday, January 2, 2013 9:25:03 PM UTC-5, Jonathan Moo wrote:
Hi Igor,
I specified the request as followed:
curl -XPOST
'localhost:9200/prototype_2013.01.03/chow-clfg/YCKJVCgzQM2z8V663Zu0Ag/_update?parent=chow-demo'
-d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
and I still received the DocumentMissingException though, even when I
could search for the exact document.
Jonathan
On Wednesday, 2 January 2013 21:03:24 UTC+8, Igor Motov wrote:
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the
documents at
Elasticsearch Platform — Find real-time answers at scale | Elastic and yet
it doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--
Hi Igor,
I tried your suggestion, but it didn't work.
However, I tried something like this:
var script = "ctx._source["chow-clfg"].count+=num";
script = JSON.stringify(script);
var data = '{"script":'+script+',"params":{"num":1}}';
data = JSON.stringify(data);
data = JSON.parse(data);
And finally it works.
Really thanks for all your help!
Jonathan
On Thursday, 3 January 2013 12:15:42 UTC+8, Igor Motov wrote:
I would try something like var script =
'ctx._source[\"chow-clfg\"].count+=num';
On Wednesday, January 2, 2013 11:11:38 PM UTC-5, Jonathan Moo wrote:
Thanks Imotov, you are right; it works when I follow your example.
Initially it couldn't work because I thought I could do *
ctx._source.chow-clfg.count+=num* instead of *
ctx._source["chow-clfg"].count+=num*.
I just realized it still doesn't work for me when I am using Nodejs to
run and somehow the JSON parser can't seem to parse the backslashes
properly. Any advice on this?
Error in updating an existing document field count in Elasticsearch · GitHub
Regards,
Jonathan
On Thursday, 3 January 2013 10:53:04 UTC+8, Igor Motov wrote:
Can you provide a full repro? It seems to work for me:
chow-demo.sh · GitHub
On Wednesday, January 2, 2013 9:25:03 PM UTC-5, Jonathan Moo wrote:
Hi Igor,
I specified the request as followed:
curl -XPOST
'localhost:9200/prototype_2013.01.03/chow-clfg/YCKJVCgzQM2z8V663Zu0Ag/_update?parent=chow-demo'
-d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
and I still received the DocumentMissingException though, even when I
could search for the exact document.
Jonathan
On Wednesday, 2 January 2013 21:03:24 UTC+8, Igor Motov wrote:
You should specify parent on URI (not in the body of the request).
On Wednesday, January 2, 2013 2:03:42 AM UTC-5, Jonathan Moo wrote:
I have indexed a document in Elasticsearch as follows:
{
_parent: chow-demo
_index: prototype_2013.01.02
_type: chow-clfg
_id: Nx4JcvyxTPujkyy0Jq5BNw
_score: 11.600378
_source: {
chow-clfg: {
@type : chow-clfg
clfg: Cg5iV00z4woYAAAARQ0
@timestamp : 2013-01-02T06:26:00.000Z
count: 1
}
}
}
I tried to update the count field by the following command:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
However I received the following error instead:
{"error":"RemoteTransportException[[Vesta][inet[/10.15.78.249:9300]][update]]; nested: DocumentMissingException[[prototype_2013.01.02][0] [chow-clfg][Nx4JcvyxTPujkyy0Jq5BNw]: document missing]; ","status":404}
What exactly have I done that is missing? I was following the
documents at
Elasticsearch Platform — Find real-time answers at scale | Elastic and yet
it doesn't work.
Also, I included the parent field:
curl -XPOST 'localhost:9200/prototype_2013.01.02/chow-clfg/Nx4JcvyxTPujkyy0Jq5BNw/_update' -d '{"parent":"chow-demo","script":"ctx._source.chow-clfg.count+=num","params":{"num":1}}'
And it still didn't work. Anyone can help me with this error?
--