Extra " while using bulk api

I am using Bulk Java Api into ingest the data into the ElasticSearch.

            JsonNode rootNode = mapper.readTree(json);  
    	Iterator<Map.Entry<String,JsonNode>> fieldsIterator = rootNode.getFields();
    	
    	Map<String, String> bulkData = new HashMap<String, String>();
    	
    	while (fieldsIterator.hasNext()) {
   
    		Map.Entry<String,JsonNode> field = fieldsIterator.next();
    		bulkData.put(field.getKey(), field.getValue().toString());
    		
    	}
    	
    	bulkRequest.add(client.prepareIndex("Testing", "Test1")
		        .setSource(bulkData)
		        );
    	BulkResponse bulkResponse = bulkRequest.get();
    		if (bulkResponse.hasFailures()) {
    			System.out.println("A problem ocurred in the bulk process");
    		    // process failures by iterating through each bulk response item
    		}

However, when I check the data in ElasticSearch, I get the following:

"Key" : """"Value""""

I checked my Hashmap values before inserting but it is fine.
What is the reason for the extra double quotes in the values of ElasticSearch?

Hey,

I suppose you checked the data in kibana? If so, that is just a display trick to be able to display data over multiple lines. If you use curl/wget you will see, that this is not an issue in your actual data.

--Alex

Thank you for the reply.
I tried cURL on terminal, the data is now of the form:
"Key" : ""Value""

i wonder why the escape character is appended in the data?

Those extra ticks are definately from your application indexing data into Elasticsearch, so I assume it existed before.

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.