ES 0.90.5 Bulk Update does not seem to work properly


(george_monroe) #1

Hi,

I've downloaded the new ES 0.90.5 and I'm running the following bulk
statements:

test.json:

{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field_1" : "value_1" }
{ "delete" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "type1", "_id" : "3" } }
{ "field_1" : "value_3" }
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "test"} }
{ "doc" : {"field_2" : "value_2"} }
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "test",
"_retry_on_conflict" : 3} }
{ "script" : "ctx._source.field_1 : "new content"" }

curl -XPOST 'localhost:9200/_bulk?pretty' --data-binary @test.json

I get the following response, which says that both updates succeeded:

{
"took" : 139,
"items" : [ {
"index" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 1,
"ok" : true
}
}, {
"delete" : {
"_index" : "test",
"_type" : "type1",
"_id" : "2",
"_version" : 1,
"ok" : true,
"found" : false
}
}, {
"create" : {
"_index" : "test",
"_type" : "type1",
"_id" : "3",
"_version" : 1,
"ok" : true
}
}, {
"update" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 2,
"ok" : true
}
}, {
"update" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 3,
"ok" : true
}
} ]

But the data shows the following (What am I doing wrong??):

{

  • _index: test
  • _type: type1
  • _id: 1
  • _version: 3
  • _score: 1
  • _source: {
    • field_1: value_1
    • field_2: value_2
      }

}

What am I doing wrong?

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(george_monroe) #2

I figured it out as soon as I had clicked post....

Instead of { "script" : "ctx._source.field_1 : "new content"" }

I should have { "script" : "ctx._source.field_1 = "new content"" }

On Monday, October 14, 2013 12:15:19 AM UTC-7, george_monroe wrote:

Hi,

I've downloaded the new ES 0.90.5 and I'm running the following bulk
statements:

test.json:

{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field_1" : "value_1" }
{ "delete" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "type1", "_id" : "3" } }
{ "field_1" : "value_3" }
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "test"} }
{ "doc" : {"field_2" : "value_2"} }
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "test",
"_retry_on_conflict" : 3} }
{ "script" : "ctx._source.field_1 : "new content"" }

curl -XPOST 'localhost:9200/_bulk?pretty' --data-binary @test.json

I get the following response, which says that both updates succeeded:

{
"took" : 139,
"items" : [ {
"index" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 1,
"ok" : true
}
}, {
"delete" : {
"_index" : "test",
"_type" : "type1",
"_id" : "2",
"_version" : 1,
"ok" : true,
"found" : false
}
}, {
"create" : {
"_index" : "test",
"_type" : "type1",
"_id" : "3",
"_version" : 1,
"ok" : true
}
}, {
"update" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 2,
"ok" : true
}
}, {
"update" : {
"_index" : "test",
"_type" : "type1",
"_id" : "1",
"_version" : 3,
"ok" : true
}
} ]

But the data shows the following (What am I doing wrong??):

{

  • _index: test
  • _type: type1
  • _id: 1
  • _version: 3
  • _score: 1
  • _source: {
    • field_1: value_1
    • field_2: value_2
      }

}

What am I doing wrong?

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3