Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
updating doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoiko committed Jun 14, 2015
1 parent e32e486 commit 2a8e62b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
3 changes: 2 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Changelog
=========

* :release:`0.4.0 <2015-06-12>`
* :release:`0.4.0 <2015-06-14>`
* :support:`-` Added python3 support
* :feature:`-` Added ES aggregations
* :feature:`-` Reworked ES bulk queries to use elasticsearch.helpers.bulk
* :feature:`-` Added ability to empty listfields by setting them to "" or null

* :release:`0.3.4 <2015-06-09>`
* :bug:`-` Fixed bug whereby _count would throw exception when authentication was enabled
Expand Down
47 changes: 40 additions & 7 deletions docs/source/making_requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,42 @@ url parameter description
======================================== ===========


update_many()
-------------
Updating listfields
-------------------

Items in listfields can be removed using "-" prefix.

PATCH `/api/<collection>/<id>

.. code-block:: json

{
"<list_field_name>": [-<item>]
}

Items can be both added and removed at the same time.

PATCH `/api/<collection>/<id>

.. code-block:: json
{
"<list_field_name>": [<item_to_add>,-<item_to_remove>]
}
Listfields can be emptied by setting their value to "" or null.

PATCH `/api/<collection>/<id>

.. code-block:: json

{
"<list_field_name>": ""
}


Updating collections
--------------------

If update_many() is defined in your view, you will be able to update a single field across an entire collection or a filtered collection. E.g.

Expand All @@ -45,20 +79,19 @@ PATCH `/api/<collection>?q=<keywords>`
.. code-block:: json
{
"<field_name>":"<new_value>"
"<field_name>": "<new_value>"
}
delete_many()
-------------
Deleting collections
--------------------

Similarly, if delete_many() is defined, you will be able to delete whole collections or filtered collections. E.g.

DELETE `/api/<collection>?_missing_=<field_name>`


.. [#] To update listfields and dictfields, you can use the following syntax: ``_m=PATCH&<listfield>=<comma_separated_list>&<dictfield>.<key>=<value>``
.. [#] To update listfields and dictfields, you can use the following syntax: ``_m=PATCH&<listfield>.<value>&<dictfield>.<key>=<value>``
.. [#] The full syntax of ElasticSearch querying is beyond the scope of this documentation. You can read more on the `ElasticSearch Query String Query documentation <http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html>`_ to do things like fuzzy search: ``?name=fuzzy~`` or date range search: ``?date=[2015-01-01 TO *]``
.. [#] Set ``elasticsearch.enable_refresh_query = true`` in your .ini file to enable this feature. This parameter only works with POST, PATCH, PUT and DELETE methods. Read more on `ElasticSearch Bulk API documentation <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#bulk-refresh>`_.
.. [#] Set ``elasticsearch.enable_aggregations = true`` in your .ini file to enable this feature. You can also use the short name `_aggs`. Read more on `ElasticSearch Aggregations <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html>`_.

0 comments on commit 2a8e62b

Please sign in to comment.