Skip to content

script_score not working #1445

Closed
Closed
@r3b311i0n

Description

@r3b311i0n

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions