You'll have to run the result through your language's equivalent of
"json_decode". The results returned by Elasticsearch are packaged in a
JSON object, so any data within has to be JSON compliant (which means
escaping characters inside of fields):
$ curl -XPOST localhost:9200/test/test/ -d '
{
"newfield" : ""myname" : "Abdulmuhaimen""
}'
{
"ok":true,
"_index":"test",
"_type":"test",
"_id":"uNWmgtr2TcqIBUgMmARnRg",
"_version":1
}
$ curl -XGET localhost:9200/test/test/uNWmgtr2TcqIBUgMmARnRg
{
"_index":"test",
"_type":"test",
"_id":"uNWmgtr2TcqIBUgMmARnRg",
"_version":1,
"exists":true,
"_source":{
"newfield":""myname" : "Abdulmuhaimen""
}
}
And then running the result through PHP's json_decode():
array (
'_index' => 'test',
'_type' => 'test',
'_id' => 'uNWmgtr2TcqIBUgMmARnRg',
'_version' => 1,
'exists' => true,
'_source' =>
array (
'newfield' => '"myname" : "Abdulmuhaimen"',
),
)
-Zach
On Monday, February 25, 2013 7:46:19 AM UTC-5, Abdelmuhaimen Mohamed wrote:
Hi all
I want to index a string like the following (' "myname" : "Abdulmuhaimen"
'), which contains the special characters " and :, when i escape them using
, the \ is retrieved as well when geting back the text from the
elasticsearch (i.e. I index the text like "myname":"Abdulmuhaimen" and
get the same when retrieving it including the escape character). I want to
index such text and get back "myname" : "Abdulmuhaimen" when searching for
it without the escape character. Any help is appreciated.
Thanks in advance
--
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.