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

script_score not working #1445

Closed
r3b311i0n opened this issue Oct 29, 2020 · 0 comments · Fixed by #1464
Closed

script_score not working #1445

r3b311i0n opened this issue Oct 29, 2020 · 0 comments · Fixed by #1464

Comments

@r3b311i0n
Copy link

Using script_score throws ValueError(Q() can only accept dict with a single query...

{
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      },
      "script": {
        "source": """
          double weight = 1;
          if (doc['type'].value == 'REVIEW') {
            weight = 1.03;
          }
          return weight * decayDateExp(params.origin, params.scale, params.offset, params.decay, doc['modified'].value);
        """,
        "params": {
          "origin": "2020-10-30T00:00:00", 
          "scale": "30d",
          "offset": "1h", 
          "decay": 0.8
        }
      }
    }
  }
}

I'm trying to convert the above but so far unsuccessful.

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 a pull request may close this issue.

1 participant