How to invoke custom rescorer plugin using elasticsearch-java 8 client


I have migrated a custom rescorer plugin from Elasticsearch version 7 to 8. I can invoke the plugin using the following request. However, I am unable to generate a similar request using elasticsearch-java 8.10.4. I tried following the post linked below but I am getting unknown query [customRescorer] when I use wrapper query inside rescore_query. It would be great if someone be able to share some pointers or a sample SearchRequest. Thanks.

  "_source": false,
  "query": {
    "match_all": {}
  "rescore": [
      "customRescorer": {
        "param1": 1,
        "param2": "name"
      "window_size": 10
  "size": 10

Sample using wrapper:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.