[MarkLogic Dev General] USing REST api to retrieve value for an element

Bhushan Suryawanshi bsuryawanshi at xenomorph.com
Tue Feb 7 11:40:06 PST 2017


Hello Team,

We are using MarkLogic 8.0 using REST API.

We have around 200,000 documents inside a collection. Each document has the following structure

<Equity>
<IDENTIFIER1 >1022</ IDENTIFIER1 >
< IDENTIFIER2>KP</ IDENTIFIER2>
<NAME >SFW </NAME >
...
</Equity>

One Requirement:

1)      Fetch value for an element for all the documents inside a collection.

I have tried below solution using Xquery:

<results>

  {

    let $a := collection("Equity")//*

    for $name in distinct-values($a/NAME)

      return

        <result>

        <name>{ $name }</name>

        </result>

  }

</results>

But the above Xquery takes a long time.

Is there any way where we can solve the above requirements using REST API.

Thanks in advance.

Bhushan Suryawanshi
Developer
t: +1-212-401-7894
www.xenomorph.com<http://www.xenomorph.com/?mail> | blog<http://xenomorph.typepad.com/?mail> | twitter<http://goo.gl/oaBWO> | linkedin<http://goo.gl/rdi8W>


This email is confidential and is intended only for the addressee. If you are not the intended recipient, please note that any dissemination, distribution or copying of this email is strictly prohibited. Any and all estimates, proposals, quotes and fees contained herein are for discussion purposes only and are not contractually binding unless executed in accordance with the standard practices of the Company. Attachments to this message have been virus checked but no guarantee can be made that any attachment is virus free. Please notify us immediately of any problem.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20170207/5ef257a6/attachment.html 


More information about the General mailing list