The DotDict is the base model used. It allows to use a dict with the DotNotation.

>>> dotdict = DotDict(foo="bar")
>>> dotdict2 = deepcopy(dotdict)
>>> dotdict2["foo"] = "baz"
>>> = "bar"
>>> "baz"


It extends DotDict adding methods for common uses.

Every search return an ElasticSearchModel as result. Iterating on results, you iterate on ElasticSearchModel objects.

You can create a new one with the factory or get one by search/get methods.

obj = self.conn.factory_object(self.index_name, self.document_type, {"name": "test", "val": 1})

You can change value via dot notation or dictionary. = "aaa"
assert == "aaa"
assert obj.val == 1

You can change ES info via ._meta property or get_meta call.

assert is None = "dasdas"
assert == "dasdas"

Remember that it works as a dict object.

assert sorted(obj.keys()) == ["name", "val"]

You can save it. = "test2"

reloaded = self.conn.get(self.index_name, self.document_type,
assert, "test2")