0
votes

Hi I am able to push data into MarkLogic using mlcp but on doing an optic query I get null as result. How can I receive a result from an optic query after pushing the data using mlcp and even after adding the schema? Or how do I map the schema with the mlcp pushing data?

Data loaded with this MLCP command:

mlcp.sh import -host localhost -port 8000 -username admin -password admin -input_file_path C:\Users\sehajpalsinghj\Documents\DPHMJSOn\csv\1.csv -input_file_type delimited_text -document_type json -mode local -output_collections test

1
I'd start with checking document permissions of what you imported with MLCP. One typically runs that with some admin user, and it is easy to forget to apply -output_permissions. See here how to use that parameter: stackoverflow.com/a/46058091/918496 - grtjn
Have you confirmed that the TDE template matches a sample document? - ehennum
Can you provide the optic query you're running and a sample document or two? There's not much we can do without those. - Dave Cassel
mlcp.sh import -host localhost -port 8000 -username admin -password admin -input_file_path C:\Users\sehajpalsinghj\Documents\DPHMJSOn\csv\1.csv -input_file_type delimited_text -document_type json -mode local -output_collections test - SehajJaggi
also refer this link for the better understanding of the question stackoverflow.com/review/suggested-edits/17363273 - SehajJaggi

1 Answers

0
votes

Are you using TDE to get information from the documents into the index? Assuming so, your TDE template must specify the context (a path in the document) and may specify one or more collections. Since you're using MLCP to generate JSON documents from CSV, you will have very flat JSON: all the properties will be part of the root object. Specify one of those properties as the context. Use the tde.nodeDataExtract function to verify that the template is extracting from the documents what you think it should be extracting -- do this before trying to do anything with Optic.

Assuming you are using TDE, I highly recommend you read all the way through the Template-Driven Extraction tutorial.