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

Typing fixes #43

Closed
wants to merge 2 commits into from
Closed

Typing fixes #43

wants to merge 2 commits into from

Conversation

virus2016
Copy link

Fix for scoring types on DecayScoreFunction

@sudo-suhas
Copy link
Owner

Hey @virus2016, thanks for the PR. However, I don't think the changes you have made are correct. See https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-decay

The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. Required for geo and numeric field. For date fields the default is now. Date math (for example now-1h) is supported for origin.

So the value for origin can be number, string or a object(geo point). The same can be seen in elasticsearch source code as well.

For the other fields:

  • scale: This can be either a string like 10d or a number. For date fields, this number would represent the milliseconds.
  • offset: This also can either be a string or a number.
  • decay: This can only be a number between 0 & 1. So changing this to number is correct.

I'd be happy to accept a PR which updates the typings and jsdoc annotations with more accurate union data types instead of *. Could you make the required changes?

@sudo-suhas
Copy link
Owner

@virus2016 could you please do the requested changes? I'd really like to merge the PR in.

@sudo-suhas sudo-suhas closed this in 580fda7 Jun 3, 2018
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

Successfully merging this pull request may close these issues.

2 participants