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

Couldn't find a way adding min_score to query body #462

Closed
oldcai opened this issue Sep 11, 2016 · 2 comments
Closed

Couldn't find a way adding min_score to query body #462

oldcai opened this issue Sep 11, 2016 · 2 comments

Comments

@oldcai
Copy link

oldcai commented Sep 11, 2016

GET /_search
{
    "min_score": 0.5,
    "query" : {
        "term" : { "user" : "kimchy" }
    }
}

Documents are here: min_score

I found that neither q = Q('query_string', query=str_query, min_score=4.0) nor Search().query(q, min_score=4.0) would work.

And, if it isn't going to be supported by elasticsearch-dsl, is there any way to filter result by score?

@honzakral
Copy link
Contributor

the min_score is a top-level argument in the body, to inject your keys into the body you can use the extra method. so in this case: s = Search().query().extra(min_score=4.0)

Hope this helps

@ipsbrittainm
Copy link

ipsbrittainm commented Nov 4, 2022

This doesn't work when doing a count() as the extra data is ignored, meaning the search() produces a different number of results to that given by the count.

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

3 participants