1
0
Fork 0
arangodb/Doxygen/doc/IndexSkiplistHttp.html

108 lines
5.3 KiB
HTML

<html><head><title>ArangoDB Manual</title> <style media="screen" type="text/css" style="display:none">body{background-color:white;font:13px Helvetica,arial,freesans,clean,sans-serif;line-height:1.4;color:#333;}#access{font-size:16px;margin-left:12px;display:block;margin-left:10px;margin-right:10px;background-color:#F3F1EE!important;}#access a{border-right:1px solid #DBDEDF;color:#A49F96;display:block;line-height:38px;padding:0 10px;text-decoration:none;}#navigation ul{text-transform:uppercase;list-style:none;margin:0;}#navigation li{float:left;position:relative;}#container{width:920px;margin:0 auto;}a{color:#4183C4;text-decoration:none;}.contents h2{font-size:24px;border-bottom:1px solid #CCC;color:black;}.contents h1{font-size:33px;border-bottom:1px solid #CCC;color:black;}.clearfix:after{content:".";display:block;clear:both;font-size:0;height:0;visibility:hidden;}/**/ *:first-child+html .clearfix{min-height:0;}/**/ * html .clearfix{height:1%;}</style></head><body><div id="container"><img src="images/logo_arangodb.png" width="397" height="67" alt="ArangoDB"><div id="access" role="navigation"><div id="navigation"><ul id="menu-ahome" class="menu"><li><a href="Home.html">Table of contents</a></li> <li><a href="http://www.arangodb.org">ArangoDB homepage</a></li></ul></div><div class="clearfix"></div></div><div>
<!-- Generated by Doxygen 1.7.5.1 -->
</div>
<div class="header">
<div class="headertitle">
<h1>Accessing Skip-List Indexes via Http </h1> </div>
</div>
<div class="contents">
<div class="textblock"><p>If a suitable skip-list index exists, then <a class="el" href="HttpSimple.html#HttpSimpleRange">/_api/simple/range</a> will use this index to execute a range query.</p>
<hr/>
<ul>
<li>
<a class="el" href="IndexSkiplistHttp.html">Accessing Skip-List Indexes via Http</a> <ul>
<li>
<a class="el" href="IndexSkiplistHttp.html#IndexSkiplistHttpEnsureSkiplist">POST /_api/index</a> </li>
<li>
<a class="el" href="IndexSkiplistHttp.html#IndexSkiplistHttpRange">POST /_api/simple/range</a> </li>
</ul>
</li>
</ul>
<hr/>
<a class="anchor" id="IndexSkiplistHttpEnsureSkiplist"></a> <hr/>
<em>POST /_api/index</em> (creates a hash index)<hr/>
<br/>
<code><b>POST /_api/index?collection=<em>collection-identifier</em></b></code></p>
<p>Creates a skip-list index for the collection <em>collection-identifier</em>, if it does not already exist. The call expects an object containing the index details.</p>
<ul>
<li><code>type</code>: must be equal to <code>"skiplist"</code>.</li>
</ul>
<ul>
<li><code>fields</code>: A list of attribute paths.</li>
</ul>
<ul>
<li><code>unique</code>: If <code>true</code>, then create a unique index.</li>
</ul>
<p>If the index does not already exists and could be created, then a <code>HTTP 201</code> is returned. If the index already exists, then a <code>HTTP 200</code> is returned.</p>
<p>If the <em>collection-identifier</em> is unknown, then a <code>HTTP 404</code> is returned. It is possible to specify a name instead of an identifier.</p>
<p>If the collection already contains documents and you try to create a unique skip-list index in such a way that there are documents violating the uniqueness, then a <code>HTTP 400</code> is returned.</p>
<p><b>Examples</b><br/>
</p>
<p>Creating a skiplist:</p>
<div class="fragment"><pre class="fragment">&gt; curl --data @- -X POST --dump - http://localhost:8529/_api/index?collection=109061392
{ "type" : "skiplist", "unique" : false, "fields" : [ "a", "b" ] }
HTTP/1.1 201 Created
content-type: application/json
{
"code": 201,
"fields": [
"a",
"b"
],
"id": "109061392/173166777",
"type": "skiplist",
"isNewlyCreated": true,
"unique": false,
"error": false
}
</pre></div> <p><a class="anchor" id="IndexSkiplistHttpRange"></a> <hr/>
<em>PUT /_api/simple/range</em> (executes simple range query)<hr/>
<br/>
<code><b>PUT /_api/simple/range</b></code></p>
<p>This will find all documents within a given range. You must declare a skip-list index on the attribute in order to be able to use a range query.</p>
<p>The call expects a JSON hash array as body with the following attributes:</p>
<ul>
<li><code>collection</code>: The identifier or name of the collection to query.</li>
</ul>
<ul>
<li><code>attribute</code>: The attribute path to check.</li>
</ul>
<ul>
<li><code>left</code>: The lower bound.</li>
</ul>
<ul>
<li><code>right</code>: The upper bound.</li>
</ul>
<ul>
<li><code>closed</code>: If true, use intervall including <code>left</code> and <code>right</code>, otherwise exclude <code>right</code>, but include <code>left</code>.</li>
</ul>
<ul>
<li><code>skip</code>: The documents to skip in the query. (optional)</li>
</ul>
<ul>
<li><code>limit</code>: The maximal amount of documents to return. (optional)</li>
</ul>
<p>Returns a cursor containing the result, see <a class="el" href="HttpCursor.html">HTTP Interface for AQL Query Cursors</a> for details.</p>
<p><b>Examples</b><br/>
</p>
<div class="fragment"><pre class="fragment">&gt; curl --data @- -X PUT --dump - http://localhost:8529/_api/simple/range
{ "collection" : "6328369086", "attribute" : "i", "left" : 2, "right" : 4 }
HTTP/1.1 201 Created
content-type: application/json
{
"code": 201,
"result": [
{ "_id": "6328369086/6329876414", "i": 2, "_rev": 6329876414 },
{ "_id": "6328369086/6329941950", "i": 3, "_rev": 6329941950 }
],
"count": 2,
"hasMore": false,
"error": false
}
</pre></div> </div></div>
</div></body></html>