Filter, then sort

Hi everybody.

I have a question about the order in which "sorts" and "filters" are executed.

I have a filtered query with filters inside. Thus, I have a sort in the first level of my search. How does the search work? Will it apply first the filters, and then do the sort over the previously filtered result? Or ALL RECORDS will be sort and then filters will be applied?

My guess is that second option is happening, because the var "took" has always about the same value (say, approximately 4 seconds), no matter if the filters lead to few results or not.
I mean, it seems like the sorting is consuming most of the took time (total volume is aprox 3 billions of records). Without the sort, the took decays to less than 200 milliseconds, but sorting is needed. The field used to sort is a kind of sequential number.

I paste the JSON file of the search, just in case it helps.

Thanks in advance.

{
"from":0,
"size":60,
"query":{
"filtered":{
"query":{
"match_all":{

        }
     },
     "filter":{
        "bool":{
           "must":[
              {
                 "range":{
                    "fechaMovimiento":{
                       "from":"20110101",
                       "to":"20140224",
                       "include_lower":true,
                       "include_upper":true
                    }
                 }
              },
              {
                 "terms":{
                    "codigoMovimiento":[
                       "0002",
                       "0001"
                    ]
                 }
              },
              {
                 "terms":{
                    "visible":[
                       "S"
                    ]
                 }
              },
              {
                 "terms":{
                    "codigoInternoDelContratoIuc":[
                       "00000000000000000012345678",
                       "00000000000000000087654321"
                      
                    ]
                 }
              }
           ]
        }
     }
  }

},
"sort":[
{
"codigoRmsOperacionExtendido":{
"order":"desc"
}
}
],
"facets":{
"facetFechas":{
"range":{
"field":"fechaMovimiento",
"ranges":[
{
"from":"20140223",
"to":"20140224"
},
{
"from":"20140216",
"to":"20140224"
},
{
"from":"20140209",
"to":"20140224"
},
{
"from":"20140123",
"to":"20140224"
},
{
"from":"20131223",
"to":"20140224"
},
{
"from":"20130223",
"to":"20140224"
},
{
"from":"20120223",
"to":"20140224"
},
{
"to":"20140224"
}
]
}
},
"facetImportes":{
"range":{
"field":"importe",
"ranges":[
{
"from":0.0,
"to":10.0
},
{
"from":10.0,
"to":100.0
},
{
"from":100.0,
"to":1000.0
},
{
"from":1000.0,
"to":10000.0
},
{
"from":10000.0
},
{
"from":-9.99,
"to":0.0
},
{
"from":-99.99,
"to":-9.99
},
{
"from":-999.99,
"to":-99.99
},
{
"from":-9999.99,
"to":-999.99
},
{
"to":-9999.99
}
]
}
},
"facetTipoMovimiento":{
"terms":{
"field":"codigoMovimiento",
"size":10
}
},
"facetCodigoContratoIuc":{
"terms":{
"field":"codigoInternoDelContratoIuc",
"size":7
}
},
"facetSubcategoria":{
"terms":{
"field":"subCategoria",
"size":80
}
}
}
}

I have run into the Exact same problem in my cluster, I have looked everywhere and the only tip I got was that it might have something to do with the field data cache. I still haven't found a solution but I will keep looking