Reputation: 32304
I am using bulk API to load data from a file and it is being imported correctly. The only problem is that if there is escape character like \"
then it is imported as-is.
I will like to remove the slash and save the result
dictionary as an object or nested document.
{
"req_id": "25cc4d-9cd6-499f-a439-c9",
"time": 109,
"result": "{\"ReceiveReturn\":\"00\"}",
"level": "info",
"message": "time taken for request",
"timestamp": "2015-04-17 23:59:59"
}
Is it possible to remove escape character?
Update:
Here is an example....
DELETE /test_index
POST /test_index/myid/
{"_uid":1234,"id":1,"name":"someName","newProperty":"some \" and some text\"Value","status":0}
POST /test_index/_search
As you can see in the results, there is a double quote. Is there anyway to remove all escaped characters before inserting the data?
Upvotes: 0
Views: 1435
Reputation: 1361
What you're doing is correct. Actually Elasticsearch is storing the document the correct way using "
. But as "
is a JSON special character when you run the query using a HTTP tool you see it like \"
. If you see your document using JSONView on Google Chrome you can see the real data like this:
{
_index: "myindex",
_type: "mytype",
_id: "1",
_score: 1,
_source: {
req_id: "25cc4d-9cd6-499f-a439-c9",
time: 109,
result: "{"ReceiveReturn" :"00"}",
level: "info",
message: "time taken for request",
timestamp: "2015-04-17 23:59:59"
}
}
Upvotes: 1