|
| 1 | + |
| 2 | +@startDocuBlock post_api_index_zkd |
| 3 | +@brief creates a multi-dimensional index |
| 4 | + |
| 5 | +@RESTHEADER{POST /_api/index#multi-dim, Create multi-dimensional index, createIndex#multi-dim} |
| 6 | + |
| 7 | +@RESTQUERYPARAMETERS |
| 8 | + |
| 9 | +@RESTQUERYPARAM{collection,string,required} |
| 10 | +The collection name. |
| 11 | + |
| 12 | +@RESTBODYPARAM{type,string,required,string} |
| 13 | +must be equal to *"zkd"*. |
| 14 | + |
| 15 | +@RESTBODYPARAM{fields,array,required,string} |
| 16 | +an array of attribute names used for each dimension. Array expansions are not allowed. |
| 17 | + |
| 18 | +@RESTBODYPARAM{unique,boolean,required,} |
| 19 | +if *true*, then create a unique index. |
| 20 | + |
| 21 | +@RESTBODYPARAM{fieldValueTypes,string,required,string} |
| 22 | +must be equal to *"double"*. Currently only doubles are supported as values. |
| 23 | + |
| 24 | +@RESTDESCRIPTION |
| 25 | +Creates a multi-dimensional index for the collection *collection-name*, if |
| 26 | +it does not already exist. The call expects an object containing the index |
| 27 | +details. |
| 28 | + |
| 29 | +@RESTRETURNCODES |
| 30 | + |
| 31 | +@RESTRETURNCODE{200} |
| 32 | +If the index already exists, then a *HTTP 200* is |
| 33 | +returned. |
| 34 | + |
| 35 | +@RESTRETURNCODE{201} |
| 36 | +If the index does not already exist and could be created, then a *HTTP 201* |
| 37 | +is returned. |
| 38 | + |
| 39 | +@RESTRETURNCODE{404} |
| 40 | +If the *collection-name* is unknown, then a *HTTP 404* is returned. |
| 41 | + |
| 42 | +@RESTRETURNCODE{400} |
| 43 | +If the index definition is invalid, then a *HTTP 400* is returned. |
| 44 | + |
| 45 | +@EXAMPLES |
| 46 | + |
| 47 | +Creating a multi-dimensional index |
| 48 | + |
| 49 | +@EXAMPLE_ARANGOSH_RUN{RestIndexCreateNewFulltext} |
| 50 | +var cn = "intervals"; |
| 51 | +db._drop(cn); |
| 52 | +db._create(cn); |
| 53 | + |
| 54 | + var url = "/_api/index?collection=" + cn; |
| 55 | + var body = { |
| 56 | + type: "zkd", |
| 57 | + fields: [ "from", "to" ], |
| 58 | + fieldValueTypes: "double" |
| 59 | + }; |
| 60 | + |
| 61 | + var response = logCurlRequest('POST', url, body); |
| 62 | + |
| 63 | + assert(response.code === 201); |
| 64 | + |
| 65 | + logJsonResponse(response); |
| 66 | +~ db._drop(cn); |
| 67 | +@END_EXAMPLE_ARANGOSH_RUN |
| 68 | +@endDocuBlock |
0 commit comments