aparo / pyes

Python connector for ElasticSearch - the pythonic way to use ElasticSearch
BSD 3-Clause "New" or "Revised" License
607 stars 270 forks source link

Issue with cross_field type for Match or MultiMatch query #507

Open jquacinella opened 8 years ago

jquacinella commented 8 years ago

It seems that PyES does not support "cross_field" queries (or any of the newer types) for Match or MultiMatch queries. For reference, here is a link to some docs. Is it just a matter of adding some values to the self._valid_types list?

@aparo Also, this project seems a bit inactive. I can fork and create a pull request, but I am no worried I am using a PyES in production while PyES is not being maintained. What is the general status of this project?

Example:

In [2]: pyes.MultiMatchQuery("title", "test", type="cross_fields") ... ----> 1 pyes.MultiMatchQuery("title", "test", type="cross_fields")

.../flask-env/local/lib/python2.7/site-packages/pyes/query.pyc in init(self, fields, text, type, slop, fuzziness, prefix_length, max_expansions, rewrite, operator, analyzer, use_dis_max, minimum_should_match, **kwargs) 1087 1088 if type not in self._valid_types: -> 1089 raise QueryError("Invalid value '%s' for type: allowed values are %s" % (type, self._valid_types)) 1090 if operator not in self._valid_operators: 1091 raise QueryError(

QueryError: Invalid value 'cross_fields' for type: allowed values are ['boolean', 'phrase', 'phrase_prefix']

jquacinella commented 8 years ago

Whoops, looks like I pulled the trigger too quickly on this one. Latest version of pyes does have support for this. Will close