Preeti,
I believe that your problem is in calling the *setScript* method. My Java
code uses the *IndexRequestBuilder.setSource* method. Try that instead. (I
have no idea what *setScript* does, or is for. The Javadocs need a lot more
care and feeding.)
Vai the HTTP interface, I verified that Elasticsearch 1.1 does the right
thing. And I don't think that any previous version of ES would have had any
issues at all.
For this test, I created a document source within the
test/schema/ucode.json file. Note that I changed the fields to match my
current [sgen] (schema generation) test index, but the data in the text
field is yours:
{
"uid" : 777,
"cn" : "Aurelio Phzee",
"sex" : "M",
"married" : true,
"date" : "1952-04-15T15:22:51Z",
"location" : [ -117.172581, 32.67819 ],
"text" : [ "\u003cp\u003eFake Operation\u003c/p\u003e",
"\u003cp\u003efake clues\u003c/p\u003e" ]
}
Add the document:
$ curl -XPOST 'http://localhost:9200/sgen/person/777' --data-binary
@test/schema/ucode.json
Query it to verify that it was stored, and pretty-print the response.
Elasticsearch returns the orignal source with the \unnnn escape sequences:
$ curl -XGET 'http://localhost:9200/sgen/person/777?pretty=true'
{
"_index" : "sgen",
"_type" : "person",
"_id" : "777",
"_version" : 1,
"found" : true, "_source" : {
"uid" : 777,
"cn" : "Aurelio Phzee",
"sex" : "M",
"married" : true,
"date" : "1952-04-15T15:22:51Z",
"location" : [ -117.172581, 32.67819 ],
"text" : [ "\u003cp\u003eFake Operation\u003c/p\u003e",
"\u003cp\u003efake clues\u003c/p\u003e" ]
}
}
Query and parse the response into pretty JSON. The *parse-json.sh* Bash
script wraps my own JSON parser, and the -j option selects pretty-printed
JSON (other options show the low-level tokens found by the Jackson stream
parser that is embedded within ES):
$ curl -XGET 'http://localhost:9200/sgen/person/777' | parse-json.sh -j
{
"_index" : "sgen",
"_type" : "person",
"_id" : "777",
"_version" : 1,
"found" : true,
"_source" : {
"uid" : 777,
"cn" : "Aurelio Phzee",
"sex" : "M",
"married" : true,
"date" : "1952-04-15T15:22:51Z",
"location" : [ -117.172581, 32.67819 ],
"text" : [ "<p>Fake Operation</p>", "<p>fake clues</p>" ]
}
}
So I see no errors in handling this on the Elasticsearch side. Must be
somewhere else, and my guess is setScript vrs. setSource. I hope this helps!
Brian
*On Thursday, April 3, 2014 8:43:51 AM UTC-4, Preeti Jain wrote:*
>
> *Hi,*
>
> *We are using elasticsearch version 1.0.1*
> *For updating one of the ES docs, following script is being passed to
> updaterequestbuilder via setScript method.*
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/01fc1102-d2eb-4ab7-b258-cc9bb62e8b6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.