Storing XML in Elastic Search without analyzing/indexing

I need to store the XML document and some information pertaining to this in ES. Basically I dont want the XML to be analyzed/indexed. The additional information for the XML will be stored in the field.
When the query is fired for the field, I need to get this XML file pertaining to the search output.

How can I store XML file in ES without indexing/analyzing it. I need to store it and get it as it is without no modification whatsoever for handling some failure scenario.
I am not looking for any additional framework or plugin. Additionally, I don't want to convert XML into JSON as I am not going to index XML.
XML to be stored as it is in ES and some properties of XML to be stored as field in ES.

How can I achieve this?

Slap the XML into a json string (you'll have to escape it) and declare that string as text but set index to false.

If you did want to convert the XML to json you could stick it under an object and declare that object as dynamic=false. dynamic=false is one of my favorite features because you can add fields to the index that are just stored and Elasticsearch doesn't do anything with them beyond storing them. It takes away that magic "elasticsearch analyzes all the things" feeling but it makes me feel more in control.

Is there a way out to store the XML straight into the ES without converting it into a JSON string (by escaping). dynamic=false might not help as I dont wish to parse XMl. I just have to store the XML in the ES with some attributes which are normal key value pair.

More so, what if my POJO contains an XML. I mean before writing the data into XML, the information is stored in POJO (a class object).
Is it possible to store the class object in ES without ES analyzing/indexing it.

You can may be store it in a field like:

  "xml": "<bla></bla>"

But whatever happens, you will need to send a JSON document to elasticsearch.

@jprante created an open source project which might help though:

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