Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MUST is undefined in 1.6.1 #46

Closed
damonms opened this issue Nov 30, 2020 · 3 comments
Closed

MUST is undefined in 1.6.1 #46

damonms opened this issue Nov 30, 2020 · 3 comments

Comments

@damonms
Copy link

damonms commented Nov 30, 2020

Hi All,

We are running some tests that have not changed, and it appears that must is undefined in get_query_type in version 1.6.1 but was not broken in version 1.5.1. Representative trace below of the issue:

.tox/py36/lib/python3.6/site-packages/elasticsearch_dsl/search.py:706: in execute
    **self._params
.tox/py36/lib/python3.6/site-packages/elasticmock/behaviour/server_failure.py:27: in decorated
    response = f(*args, **kwargs)
.tox/py36/lib/python3.6/site-packages/elasticsearch/client/utils.py:84: in _wrapped
    return func(*args, params=params, **kwargs)
.tox/py36/lib/python3.6/site-packages/elasticmock/fake_elasticsearch.py:377: in search
    if condition.evaluate(document):
.tox/py36/lib/python3.6/site-packages/elasticmock/fake_elasticsearch.py:54: in evaluate
    return self._evaluate_for_query_type(document)
.tox/py36/lib/python3.6/site-packages/elasticmock/fake_elasticsearch.py:64: in _evaluate_for_query_type
    return self._evaluate_for_compound_query_type(document)
.tox/py36/lib/python3.6/site-packages/elasticmock/fake_elasticsearch.py:102: in _evaluate_for_compound_query_type
    QueryType.get_query_type(query_type),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

type_str = 'must'

    @staticmethod
    def get_query_type(type_str):
        if type_str == 'bool':
            return QueryType.BOOL
        elif type_str == 'filter':
            return QueryType.FILTER
        elif type_str == 'match':
            return QueryType.MATCH
        elif type_str == 'term':
            return QueryType.TERM
        elif type_str == 'terms':
            return QueryType.TERMS
        else:
>           raise NotImplementedError(f'type {type_str} is not implemented for QueryType')
E           NotImplementedError: type must is not implemented for QueryType

.tox/py36/lib/python3.6/site-packages/elasticmock/fake_elasticsearch.py:42: NotImplementedError

We can push out a fix, but wondering if there was a reason that must is no longer defined. For reference, we are on elasticsearch 6.5.

Cheers,
Steve

@vrcmarcos
Copy link
Owner

Don't know if it was my bad or not. Could you please send a PR fixing that?

@damonms
Copy link
Author

damonms commented Dec 1, 2020

Sure thing!

@vrcmarcos
Copy link
Owner

Just upload v1.6.2 with the PRs fixing it. Ty for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants