Hi, Bhushan:
It sounds like it would meet your requirements to create a range index on NAME
and use the /v1/values endpoint to retrieve the values from the index:
http://docs.marklogic.com/guide/rest-dev/search#id_24780
http://docs.marklogic.com/REST/POST/v1/values/[name]
Hoping that helps,
Erik Hennum
________________________________
From: [email protected]
[[email protected]] on behalf of Bhushan Suryawanshi
[[email protected]]
Sent: Tuesday, February 07, 2017 11:40 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] USing REST api to retrieve value for an element
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.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general