mozilla / elasticutils

[deprecated] A friendly chainable ElasticSearch interface for python
http://elasticutils.rtfd.org
BSD 3-Clause "New" or "Revised" License
243 stars 76 forks source link

Add support for _all in text/text_phrase/match/match_phrase queries #128

Open willkg opened 11 years ago

willkg commented 11 years ago

Currently you can specify a field with text/text_phrase/match/match_phrase queries:

s = S().query(foo__match='bar')

creates the query clause:

query: {
    {'match': {'foo': 'bar'}}
}

However, Elasticsearch allows you to use _all which will search all the fields.

Two possible ways we could do this off the top of my head.

Possibility 1:

s = S().query(__match='bar')

Possibility 2:

s = S().query(_all__match='bar')

The second possibility works already--we'd just have to document it. Is that too weird?

robhudson commented 11 years ago

Possibility 1 is weird to me. 2 is ok. Adding a query_all seems overkill.

willkg commented 11 years ago

Possibility 2 works already, so we'd just need to document it. Adding a query_all breaks out of the API, so I'm kind of loathe to do that without serious thought/compelling reasons at the moment.

Anyhow, that's two votes for possibility 2 so far. I'll let this stew a bit for other votes and syntax options.