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

ScoreFunction is not documented - Unknown query [function_score] #1561

Open
andyhmltn opened this issue Jan 18, 2022 · 0 comments
Open

ScoreFunction is not documented - Unknown query [function_score] #1561

andyhmltn opened this issue Jan 18, 2022 · 0 comments

Comments

@andyhmltn
Copy link

andyhmltn commented Jan 18, 2022

Hello,

I'm trying to implement a function score using elasticsearch-dsl-py. So I'm trying to use ScoreFunction like so:

score_function = ScoreFunction(weight=5, filter=Range(linked_user__last_login={'gt': 'now-1y'}))

However if I call to_dict on that method I can see the dictionary returned has None as a key which seems wrong:

{None: {},
 'filter': {'range': {'linked_user.last_login': {'gt': 'now-1y'}}},
 'weight': 5}

Then if I try to use that with my search like so (after a hint from here: #608 (comment)):

search.query = FunctionScore(query=search.query, functions=[score_function])

and call search.execute() I get:

RequestError(400, 'parsing_exception', 'unknown query [function_score] did you mean any of [random_score, script_score]?')

What's the cause for this? The only documentation I can find on this is in issue #608 and using the example results in the following error.

Thank you!

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

No branches or pull requests

2 participants