0
votes

I need to search using rest api and the search should return me only the document not the usual search result. Basically, I'm going to search for a json document with the property name.

For eg:

{
        "envelope": {
            "metadata": {
                "documentType": "Marklogic Batch Audit",
                "documentVersion": "1.0",
                "domain": "WDS",
                "ingestDateTime": "3/19/2019, 4:19:23 AM",
                "ingestSourceSystem": "WDS",
                "ingestSourceSystemVersion": "1.0",
                "ingestUser": "admin",
                "moduleVersion": "1.0"
            },
            "content": {
                "GUID": "Unique ID",
                "scheduleName": "WDS-ML-Daily",
                "scheduleDescripton": "This is daily Marklogic WDS batch",
                "orderDate": "03072019",
                "scheduleStartTimestamp": "3/19/2019, 4:19:23 AM",
                "scheduleEndTimestamp": "",
                "scheduleStatus": "running"
            }
        }
    }

I want to search using json property "scheduleName". When i pass "WDS-ML-Daily", my search should return this doucument.

I also want the search to be in specific collection.

How can I do this?

1

1 Answers

1
votes

When you use multipart/mixed as the Accept mime type, the response provides the matched documents instead of a summary of the matched portions of the documents.

You can use GET or POST to pass in a structured query that specifies an AND query over a JSON property value query and a collection query.

For more information, see:

http://docs.marklogic.com/guide/rest-dev/bulk#id_65903

http://docs.marklogic.com/REST/GET/v1/search

http://docs.marklogic.com/guide/search-dev/structured-query#id_59265

Hoping that helps,