elasticsearch-xml icon indicating copy to clipboard operation
elasticsearch-xml copied to clipboard

Difficulties in Running Sample Code in README.md

Open alexandercronin opened this issue 8 years ago • 6 comments

Hi,

I am new to elastic search and am looking to load in a large number of xml files. I was excited to find your plugin but am experiencing difficulties.Following successful install of your plug and restating of ES I attempted to execute the sample code in README.md with the following errors. Perhaps I am doing something incorrect

Code starting: curl '0:9200/_search?pretty' Error: > "_score" : 1.0, "_source" : {"@context":{"p":"http://dummy.org"},"p:foo":"bar"}

} ]

-bash: syntax error near unexpected token `]'

Code starting: curl -H 'Accept: application/xml' '0:9200/_search?pretty' Error: There appears to be no quoting of the xml and when I attempt this I get parse exception errors.

As I am new to this I assume that there is something simple I am doing incorrectly and I was hoping that you could guide me.

Kind regards, Alex

alexandercronin avatar Aug 22 '16 15:08 alexandercronin

In the README, I was sloppy while formatting the demonstration. Please consider only the lines beginning with curl as commands that should be entered. The lines after curl are the output of the command for documentation.

The plugin is not considered to work with existing XML files. It assumes special XML that match the conventions of Elasticsearch to the JSON transformation is straightforward. In general, it does not save you from preprocessing existing XML.

jprante avatar Aug 22 '16 20:08 jprante

Hi Jörg, Thanks for taking the time to deal with my newbie query :) I should have definitely spotted that.

The standard commands to interact with elasticsearch node are giving the expected responses but when I am attempting to use your extension the node is returning an error. Other commands related to the extension are producing similar errors. I am guessing it is another newbie mistake so if you can point me in the right direction to further reading etc to resolve this issue I would be very grateful :)

Command : curl -H 'Accept: application/xml' '0:9200/_search?pretty' Error 2016-08-23 11:16:49,219][ERROR][org.xbib.elasticsearch.rest.xml.XmlFilter] Not implemented java.lang.UnsupportedOperationException: Not implemented at org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:380) at org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:373) at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter$Lf2SpacesIndenter.writeIndentation(DefaultXmlPrettyPrinter.java:511) at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.writeLeafElement(DefaultXmlPrettyPrinter.java:321) at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeNumber(ToXmlGenerator.java:814) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.writeNumber(XmlXContentGenerator.java:173) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentEvent(XmlXContentGenerator.java:409) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:378) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:373) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:348) at org.xbib.elasticsearch.common.xcontent.XmlXContentBuilder.copyCurrentStructure(XmlXContentBuilder.java:1005) at org.xbib.elasticsearch.rest.xml.XmlFilter$XmlChannel.sendResponse(XmlFilter.java:166) at org.elasticsearch.rest.action.support.RestResponseListener.processResponse(RestResponseListener.java:43) at org.elasticsearch.rest.action.support.RestActionListener.onResponse(RestActionListener.java:49) at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:89) at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85) at org.elasticsearch.action.search.SearchQueryThenFetchAsyncAction$2.doRun(SearchQueryThenFetchAsyncAction.java:138) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

alexandercronin avatar Aug 23 '16 10:08 alexandercronin

OK, I noticed the build is wrong, A jar is missing in the plugin zip. Please put the woodstox 5.0.2 jar into the "plugins/xml' folder, from the URL

http://search.maven.org/remotecontent?filepath=com/fasterxml/woodstox/woodstox-core/5.0.2/woodstox-core-5.0.2.jar

Maybe this is sufficient to make it work again. The jar will be included in the next release.

jprante avatar Aug 23 '16 12:08 jprante

Hi Jorg,

Thanks for you quick reply. I have attempted the solution proposed but I am still getting the error below. If you have any additional advice I would be grateful. I am looking forward to using your plugin in relation to dataset management for some phd research I am doing in deep learning related to handwriting recognition :)

2016-08-23 23:12:31,819][ERROR][org.xbib.elasticsearch.rest.xml.XmlFilter] Not implemented java.lang.UnsupportedOperationException: Not implemented at org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:380) at org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:373) at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter$Lf2SpacesIndenter.writeIndentation(DefaultXmlPrettyPrinter.java:511) at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.writeLeafElement(DefaultXmlPrettyPrinter.java:321) at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeNumber(ToXmlGenerator.java:814) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.writeNumber(XmlXContentGenerator.java:173) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentEvent(XmlXContentGenerator.java:409) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:378) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:373) at org.xbib.elasticsearch.common.xcontent.xml.XmlXContentGenerator.copyCurrentStructure(XmlXContentGenerator.java:348) at org.xbib.elasticsearch.common.xcontent.XmlXContentBuilder.copyCurrentStructure(XmlXContentBuilder.java:1005) at org.xbib.elasticsearch.rest.xml.XmlFilter$XmlChannel.sendResponse(XmlFilter.java:166) at org.elasticsearch.rest.action.support.RestResponseListener.processResponse(RestResponseListener.java:43) at org.elasticsearch.rest.action.support.RestActionListener.onResponse(RestActionListener.java:49) at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:89) at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85) at org.elasticsearch.action.search.SearchQueryThenFetchAsyncAction$2.doRun(SearchQueryThenFetchAsyncAction.java:138) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

alexandercronin avatar Aug 23 '16 22:08 alexandercronin

I released plugin version 2.3.5.1 with a fix.

Thanks for reporting.

jprante avatar Aug 24 '16 17:08 jprante

Hi Jörg, tested on my local install and it is working great, look forward to exploring it more over the next few days: ) Thanks for all your hard work!

alexandercronin avatar Aug 25 '16 12:08 alexandercronin