1

I am trying to export files from Marklogic server (installed on my machine) to my local environment, and I am getting the following error :

mlcp.sh export -host localhost -port 8000 -username admin \
>     -password admin -mode local -output_file_path \
>     /output_dir \
> -database data-hub-FINAL -document_selector {/envelope/instance/name-entity} \
> -query_filter {"wordQuery":{"name":["Jason"]}}


WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.hadoop.security.authentication.util.KerberosUtil (file:/mnt/c/Users/imam/Documents/2020_Learning_Imane/marklo/project/flight_school/mlcp-10.0.4.2/lib/hadoop-auth-2.6.0.jar) to method sun.security.krb5.Config.getInstance()
WARNING: Please consider reporting this to the maintainers of org.apache.hadoop.security.authentication.util.KerberosUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20/08/25 17:52:05 INFO contentpump.ContentPump: Job name: local_2008896403_1
20/08/25 17:52:05 ERROR mapreduce.MarkLogicInputFormat: com.marklogic.xcc.exceptions.XQueryException: XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected Lbrace_
 [Session: user=admin, cb=data-hub-FINAL [ContentSource: user=admin, cb=data-hub-FINAL [provider: address=localhost/127.0.0.1:8000, pool=1/64]]]
 [Client: XCC/10.0-4, Server: XDBC/10.0-3]
on line 1
expr:  ,
in xdmp:eval("for $f in xdmp:forest-open-replica(xdmp:database-forests(xdmp:da...")
in /MarkLogic/hadoop.xqy, on line 32
expr:  ,
in hadoop:get-splits("", "{/envelope/instance/name-entity}", "cts:query(xdmp:unquote('{wordQuery:{name:[Jason]}}')/*)")
in /eval, on line 5
expr:

I don't know what I am missing, I already tried a simple import and it worked perfectly. So I'm guessing the error comes from my query syntaxe.

Any ideas ? Many thanks

manie
  • 355
  • 1
  • 5
  • 13
  • It appears that all of the double quotes are being stripped out, making the query that is executed invalid JSON when it attempts to unquote `cts:query(xdmp:unquote('{wordQuery:{name:[Jason]}}')/*)` – Mads Hansen Aug 25 '20 at 16:51

1 Answers1

1

https://docs.marklogic.com/guide/mlcp/export#id_66898

Using an options file is recommended when using -query_filter because both XML and JSON serialized queries contain quotes and other characters that have special meaning to the Unix and Windows command shells, making it challenging to properly escape the query.

If you use -query_filter on the command line, you must quote the serialized query and may need to do additional special character escaping.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
  • Exactly, I used -options_file command (syntaxe error) , and my query was also false (node error), it should be : {"wordQuery":{"text":["Jason"]}}. My issue now, is with the -document_selector, I get the Error parsing command arguments / Unrecognized option: -document_selector {/envelope/instance/name-entity}. – manie Aug 25 '20 at 17:19
  • for `document_selector` are you sure that you need the curly braces wrapping? If it's just an XPath I would think it would just be `-document_selector /envelope/instance/name-entity` – Mads Hansen Aug 25 '20 at 17:34
  • I did that but didn't work. I am not sure if the filter -document_selector is what I need. What I want is to export from each documents the informations that are under the entity name-entity. do you think we can do this with mlcp filters ? – manie Aug 25 '20 at 17:47