def test_reverse(): d = { "query": { "filtered": { "filter": { "bool": { "should": [ {"term": {"category": "meetup"}}, {"term": {"category": "conference"}}, ] } }, "query": { "bool": { "must": [{"match": {"title": "python"}}], "must_not": [{"match": {"title": "ruby"}}], "minimum_should_match": 2, } }, } }, "script": { "source": "ctx._source.likes += params.f", "lang": "painless", "params": {"f": 3}, }, } d2 = deepcopy(d) ubq = UpdateByQuery.from_dict(d) assert d == d2 assert d == ubq.to_dict()
def test_reverse(): d = { 'query': { 'filtered': { 'filter': { 'bool': { 'should': [{ 'term': { 'category': 'meetup' } }, { 'term': { 'category': 'conference' } }] } }, 'query': { 'bool': { 'must': [{ 'match': { 'title': 'python' } }], 'must_not': [{ 'match': { 'title': 'ruby' } }], 'minimum_should_match': 2 } } } }, 'script': { 'source': 'ctx._source.likes += params.f', 'lang': 'painless', 'params': { 'f': 3 } } } d2 = deepcopy(d) ubq = UpdateByQuery.from_dict(d) assert d == d2 assert d == ubq.to_dict()
def test_reverse(): d = { 'query': { 'filtered': { 'filter': { 'bool': { 'should': [ {'term': {'category': 'meetup'}}, {'term': {'category': 'conference'}} ] } }, 'query': { 'bool': { 'must': [ {'match': {'title': 'python'}}], 'must_not': [{'match': {'title': 'ruby'}}], 'minimum_should_match': 2 } } } }, 'script': { 'source': 'ctx._source.likes += params.f', 'lang': 'painless', 'params': { 'f': 3 } } } d2 = deepcopy(d) ubq = UpdateByQuery.from_dict(d) assert d == d2 assert d == ubq.to_dict()
def test_from_dict_doesnt_need_query(): ubq = UpdateByQuery.from_dict({'script': {'source': 'test'}}) assert { 'script': {'source': 'test'} } == ubq.to_dict()
def test_from_dict_doesnt_need_query(): ubq = UpdateByQuery.from_dict({'script': {'source': 'test'}}) assert {'script': {'source': 'test'}} == ubq.to_dict()
def test_from_dict_doesnt_need_query(): ubq = UpdateByQuery.from_dict({"script": {"source": "test"}}) assert {"script": {"source": "test"}} == ubq.to_dict()