Skip to content
This repository was archived by the owner on Oct 17, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions src/api/database/find.rst
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,6 @@ built using MapReduce Views.
:query string type: Can be ``"json"`` or ``"text"``. Defaults to json.
Geospatial indexes will be supported in the future. *Optional*
Text indexes are supported via a third party library *Optional*
:query json partial_filter_selector: A :ref:`selector <find/selectors>`
to apply to documents at indexing time, creating a
:ref:`partial index <find/partial_indexes>`. *Optional*
:query boolean partitioned: Determines whether a JSON index is partitioned
or global. The default value of ``partitioned`` is the ``partitioned``
property of the database. To create a global index on a
Expand All @@ -987,14 +984,18 @@ built using MapReduce Views.
:code 200: Index created successfully or already exists
:code 400: Invalid request
:code 401: Admin permission required
:code 404: Database not found
:code 500: Execution error

**Index object format for JSON type indexes**
The `Index object` is a JSON object with the following fields:

The index object is a JSON array of field names following the :ref:`sort
syntax <find/sort>`. Nested fields are also allowed, e.g. `"person.name"`.
:json array fields: array of field names following the :ref:`sort
syntax <find/sort>`. Nested fields are also allowed, e.g. `"person.name"`.
:json json partial_filter_selector: A :ref:`selector <find/selectors>`
to apply to documents at indexing time, creating a
:ref:`partial index <find/partial_indexes>`. *Optional*

Example of creating a new index for the field called ``foo``:
Example of creating a new index for a field called ``foo``:

**Request**:

Expand Down Expand Up @@ -1034,19 +1035,36 @@ The returned JSON confirms the index has been created:

Example index creation using all available query parameters

.. code-block:: javascript
**Request**:

{
"selector": {
"year": {
"$gt": 2010
.. code-block:: http

POST /db/_index HTTP/1.1
Content-Type: application/json
Content-Length: 396
Host: localhost:5984

{
"index": {
"partial_filter_selector": {
"year": {
"$gt": 2010
},
"limit": 10,
"skip": 0
},
"fields": [
"_id",
"_rev",
"year",
"title"
]
},
"ddoc": "example-ddoc",
"name": "example-index",
"type": "json",
"partitioned": false
}
},
"fields": ["_id", "_rev", "year", "title"],
"sort": [{"year": "asc"}],
"limit": 10,
"skip": 0
}

By default, a JSON index will include all documents that have the indexed fields
present, including those which have null values.
Expand Down
2 changes: 1 addition & 1 deletion src/api/server/common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ containing only the requested individual statistic.

:>header Content-Type: :mimetype:`application/json`
:code 200: Request completed successfully
:code 404: The server is unavaialble for requests at this time.
:code 404: The server is unavailable for requests at this time.

**Response**:

Expand Down
2 changes: 1 addition & 1 deletion src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# should be over-written using rebar-inherited settings
version = "3.1"
release = "3.1.0"
release = "3.1.1"

project = u"Apache CouchDB\u00ae"

Expand Down