Added minimum_should_match support to terms query.#257
Added minimum_should_match support to terms query.#257patrick91 wants to merge 2 commits intomozilla:masterfrom
Conversation
|
I'm hesitant to continue going down the "If there's one thing, then it means this... if there are two things then it means this..." path because that's not very flexible. Alternative options are like this:
Here are some examples: Option 1: sending a dict Option 2: Some Value class Option 3: shorthand or "you're doing the ES stuff yourself" Option 2 and 3 are similarish, but Option 3 is more flexible since it handles keys that don't have to be Python identifiers. Option 3 has the advantage that ElasticUtils could see it and then just pass it along. So it supports all Elasticsearch possibilities and we don't have to do anything extra. There's another library called elasticsearch-dsl-py. That has some similar things with ElasticUtils, however, it only allows you to specify one single query/filter per Anyhow, I think I'd rather go with Option 3. It solves some other problems, too. Then users get some good-enough defaults with simple shorthands and if they outgrow that, they can start using Elasticsearch stuff without us having to do work to support things. What do others thing? |
|
About the option two, I don't know if it is a good idea to have a TermsQuery (which extends Q) class dedicated to Terms query. The Value class looks too generic to me. |
|
If we go down the "let's write a class for everything Elasticsearch does", that's a lot of classes and a lot of work to support things. That's why I was thinking a generic option is better. |
|
So you'd like to have a Value class which basically gets converted to a JSON structure? |
|
I think I prefer option 3, but I'm interested in seeing other options and discussing pros and cons. |
|
Ok :) I'm happy to fix my PR once we got a nice way to deal with this |
@willkg let me know what do you think about this