diff --git a/Changelog b/Changelog
index 2b484de4..6b1dd3d1 100644
--- a/Changelog
+++ b/Changelog
@@ -32,7 +32,7 @@ v. 0.16.0:
Add ScriptFields object used as parameter script_fields of Search object (aguereca).
- Add IdsQuery, IdsFilter and deleteByQuery (aguereca).
+ Add IdsQuery, IdsFilter and delete_by_query (aguereca).
Bulk delete (acdha).
diff --git a/pyes/es.py b/pyes/es.py
index 1e200de9..9b857c0d 100644
--- a/pyes/es.py
+++ b/pyes/es.py
@@ -1139,7 +1139,7 @@ def delete(self, index, doc_type, id, bulk=False, querystring_args=None):
path = self._make_path([index, doc_type, id])
return self._send_request('DELETE', path, params=querystring_args)
- def deleteByQuery(self, indices, doc_types, query, **request_params):
+ def delete_by_query(self, indices, doc_types, query, **request_params):
"""
Delete documents from one or more indices and one or more types based on a query.
"""
@@ -1157,7 +1157,7 @@ def deleteByQuery(self, indices, doc_types, query, **request_params):
# A direct set of search parameters.
body = json.dumps(query, cls=self.encoder)
else:
- raise InvalidQuery("deleteByQuery() must be supplied with a Query object, or a dict")
+ raise InvalidQuery("delete_by_query() must be supplied with a Query object, or a dict")
path = self._make_path([','.join(indices), ','.join(doc_types), '_query'])
return self._send_request('DELETE', path, body, querystring_args)
diff --git a/pyes/query.py b/pyes/query.py
index ec8b534d..4a0b61b2 100644
--- a/pyes/query.py
+++ b/pyes/query.py
@@ -105,7 +105,7 @@ def __init__(self,
self.fields = fields
self.start = start
self.size = size
- self.highlight = highlight
+ self._highlight = highlight
self.sort = sort
self.explain = explain
self.facet = facet or FacetFactory()
@@ -115,6 +115,7 @@ def __init__(self,
self.index_boost = index_boost
self.min_score = min_score
self.stats = stats
+ self.bulk_read = bulk_read
def get_facet_factory(self):
"""
@@ -141,8 +142,8 @@ def serialize(self):
res['size'] = self.size
if self.start is not None:
res['from'] = self.start
- if self.highlight:
- res['highlight'] = self.highlight.serialize()
+ if self._highlight:
+ res['highlight'] = self._highlight.serialize()
if self.sort:
res['sort'] = self.sort
if self.explain:
@@ -166,6 +167,12 @@ def serialize(self):
res['stats'] = self.stats
return res
+ @property
+ def highlight(self):
+ if self._highlight is None:
+ self._highlight = HighLighter("", "")
+ return self._highlight
+
def add_highlight(self, field, fragment_size=None,
number_of_fragments=None, fragment_offset=None):
"""Add a highlight field.
@@ -173,9 +180,9 @@ def add_highlight(self, field, fragment_size=None,
The Search object will be returned, so calls to this can be chained.
"""
- if self.highlight is None:
- self.highlight = HighLighter("", "")
- self.highlight.add_field(field, fragment_size, number_of_fragments, fragment_offset)
+ if self._highlight is None:
+ self._highlight = HighLighter("", "")
+ self._highlight.add_field(field, fragment_size, number_of_fragments, fragment_offset)
return self
def add_index_boost(self, index, boost):