Hi guys i'm new to elasticsearch and im trying to process the error im currently getting here. So i just want a single field value for example "xmldata" which i added in a earlier process in the xml file. The xml is formatted to json an succesfully loaded to my ES-Server, the json file is correct.
Here my code:
Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
// GetResponse response = client.prepareGet("store", "xml",
// xsdid).setFields("xmldata").execute().actionGet();
GetResponse response = client.prepareGet().setIndex("store").setType("xml").setId(xsdid).setFields("xml").execute().actionGet();
String id = (String) response.getSource().get("xml");
i'm getting follow Error:
MapperParsingException[failed to parse]; nested: IllegalArgumentException[Malformed content, found extra data after parsing: START_OBJECT];
My XML looks like this if you need it:
<?xml version="1.0" encoding="UTF-8"?><XmlDoc><FunctionResult result="success"><Message>Processed Correct!</Message></FunctionResult>
<billing>
<billing_id>571</billing_id>
<appid>mft</appid>
<senderbtid>20041900-107</senderbtid>
<receiverbtid>20041900-40</receiverbtid>
<messagetype>M_SLSRPT</messagetype>
<messageid>83815</messageid>
<messageprops/>
<tmid>842</tmid>
<tmmsgcnt>0</tmmsgcnt>
<tmmsgtotal>1</tmmsgtotal>
<procdate>2014-12-02T03:10:15.406</procdate>
<xmldata>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48WG1sRG9jPg0KPGJpbGxpbmc+DQo8YmlsbGluZ19pZD41NzE8L2JpbGxpbmdfaWQ+DQo8YXBwaWQ+bWZ0PC9hcHBpZD4NCjxzZW5kZXJidGlkPjIwMDQxOTAwLTEwNzwvc2VuZGVyYnRpZD4NCjxyZWNlaXZlcmJ0aWQ+MjAwNDE5MDAtNDA8L3JlY2VpdmVyYnRpZD4NCjxtZXNzYWdldHlwZT5NX1NMU1JQVDwvbWVzc2FnZXR5cGU+DQo8bWVzc2FnZWlkPjgzODE1PC9tZXNzYWdlaWQ+DQo8bWVzc2FnZXByb3BzLz4NCjx0bWlkPjg0MjwvdG1pZD4NCjx0bW1zZ2NudD4wPC90bW1zZ2NudD4NCjx0bW1zZ3RvdGFsPjE8L3RtbXNndG90YWw+DQo8cHJvY2RhdGU+MjAxNC0xMi0wMlQwMzoxMDoxNS40MDY8L3Byb2NkYXRlPg0KPC9iaWxsaW5nPg0KPC9YbWxEb2M+DQoNCg==</xmldata></billing>
</XmlDoc>
Please help me! Thanks
Client client = TransportClient.builder().build().addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
GetResponse getResponse = client.prepareGet("database", "xsd", xsdid).execute().actionGet();
Map<String, Object> source = getResponse.getSource();
Like this i'm getting the full json-file back
but is there a better way just to get the single one (xmldata)?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.