Use function_score with index.sort to get top X and rescore on those

Hi,

I have a field 'mysort', I can declare it float, rankfeature...whatever I want.

I use it for index sort:

{
  "settings": {
    "index": {
      "sort.field": "mysort", 
      "sort.order": "desc"  
    }
  },

And now I want to run a query such that:

    "query": {
        "function_score": {
            "functions": [{ "field_value_factor": { "field": "mysort",  "factor": 0.5,  "modifier": "ln1p"}} ],
            "query": {....}
     },
     "rescore" : {
        "window_size" : 200,
        "query" : {  "rescore_query" : {... },  "query_weight" : 0.7,  "rescore_query_weight" : 1.2    }
     }
  • use a function_score with field_value_factor and some filters
  • the index sort field is used to get top X docs, without touching the rest
  • and those are then rescored with a 'rescore' query that is much more complex and slow, with some painless and such.

But I am struggling to find the way, not sure it's possible? As I am not 'sorting' per se, not sure if the index sort would be used if I use function_score??

Any other idea??

thanks