如何使用rest api搜索和返回文档?

问题描述 投票:0回答:1

我需要使用rest api进行搜索,搜索应该只返回文件而不是通常的搜索结果。基本上,我要搜索带有属性名称的json文档。

例如:

{
        "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"
            }
        }
    }

我想使用json属性“scheduleName”进行搜索。当我通过“WDS-ML-Daily”时,我的搜索应该返回此doucument。

我也希望搜索在特定的集合中。

我怎样才能做到这一点?

marklogic marklogic-8 marklogic-9
1个回答
0
投票

当您使用multipart / mixed作为Accept mime类型时,响应将提供匹配的文档,而不是文档的匹配部分的摘要。

您可以使用GET或POST传递结构化查询,该查询通过JSON属性值查询和集合查询指定AND查询。

有关更多信息,请参阅:

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

希望有所帮助,

© www.soinside.com 2019 - 2024. All rights reserved.