From f9f65b7a18563d8a17df915482e308146ac055b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Fri, 17 Jan 2014 15:41:07 +0100 Subject: [PATCH] Updated the get apis --- elasticsearch/client/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 2a4314bb..6750d8fa 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -198,7 +198,7 @@ class Elasticsearch(object): return True @query_params('_source', '_source_exclude', '_source_include', 'fields', - 'parent', 'preference', 'realtime', 'refresh', 'routing') + 'parent', 'preference', 'realtime', 'refresh', 'routing', 'version', 'version_type') def get(self, index, id, doc_type='_all', params=None): """ Get a typed JSON document from the index based on its id. @@ -223,13 +223,16 @@ class Elasticsearch(object): :arg refresh: Refresh the shard containing the document before performing the operation :arg routing: Specific routing value + :arg version: Explicit version number for concurrency control + :arg version_type: Explicit version number for concurrency control + """ _, data = self.transport.perform_request('GET', _make_path(index, doc_type, id), params=params) return data - @query_params('_source_exclude', '_source_include', 'parent', 'preference', - 'realtime', 'refresh', 'routing') + @query_params('_source', '_source_exclude', '_source_include', 'parent', 'preference', + 'realtime', 'refresh', 'routing', 'version', 'version_type') def get_source(self, index, id, doc_type='_all', params=None): """ Get the source of a document by it's index, type and id. @@ -239,9 +242,11 @@ class Elasticsearch(object): :arg doc_type: The type of the document (uses `_all` by default to fetch the first document matching the ID across all types) :arg id: The document ID - :arg exclude: A list of fields to exclude from the returned + :arg _source: True or false to return the _source field or not, or a + list of fields to return + :arg _source_exclude: A list of fields to exclude from the returned _source field - :arg include: A list of fields to extract and return from the + :arg _source_include: A list of fields to extract and return from the _source field :arg parent: The ID of the parent document :arg preference: Specify the node or shard the operation should be @@ -250,6 +255,8 @@ class Elasticsearch(object): :arg refresh: Refresh the shard containing the document before performing the operation :arg routing: Specific routing value + :arg version: Explicit version number for concurrency control + :arg version_type: Explicit version number for concurrency control """ _, data = self.transport.perform_request('GET', _make_path(index, doc_type, id, '_source'), params=params)