From cb6eca286012f7d1af0b86159857c105fba47928 Mon Sep 17 00:00:00 2001 From: Alberto Paro Date: Thu, 2 Feb 2012 16:58:28 +0100 Subject: [PATCH] Added _routing and dynamic_date_formats in DocumentObjectField --- pyes/mappings.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyes/mappings.py b/pyes/mappings.py index f8df27ba..91c6537e 100644 --- a/pyes/mappings.py +++ b/pyes/mappings.py @@ -325,8 +325,8 @@ def __init__(self, *args, **kwargs): class DocumentObjectField(object): def __init__(self, name=None, type=None, path=None, properties=None, dynamic=None, enabled=None, _all=None, _boost=None, _id=None, - _index=None, _source=None, _type=None, date_formats=None, - _parent=None, _timestamp=None, connection=None, index_name=None): + _index=None, _source=None, _type=None, date_formats=None, _routing=None, + _parent=None, _timestamp=None, connection=None, index_name=None, dynamic_date_formats=None): self.name = name self.type = "object" self.path = path @@ -343,6 +343,9 @@ def __init__(self, name=None, type=None, path=None, properties=None, self._id = _id self._index = _index self._source = _source + self._routing = _routing + self.dynamic_date_formats = dynamic_date_formats + self._type = _type if self._type is None: self._type = {"store" : "yes"} @@ -373,6 +376,8 @@ def as_dict(self): result['_all'] = self._all if self._boost is not None: result['_boost'] = self._boost + if self._routing is not None: + result['_routing'] = self._routing if self._id is not None: result['_id'] = self._id if self._timestamp is not None: @@ -381,6 +386,8 @@ def as_dict(self): result['_index'] = self._index if self._parent is not None: result['_parent'] = self._parent + if self.dynamic_date_formats is not None: + result['dynamic_date_formats'] = self.dynamic_date_formats if self.properties: for name, value in self.properties.items():