I'm seeing some major performance difference depending on if I wrap my filter 
in a query. I don't understand, because the docs say to use filters for exact 
matching.

This query takes about 800ms, even after repeated executions (so caches are 
hot):
{  "filter": {  "term": {  "ProjectId": 4191152 }  },
  "from": 0,  "size": 50,
  "sort": [],  "facets": {}
}

But slapping query filtered around it makes it take 5ms on repeated executions:

{  "query": { "filtered": {
      "filter": { "term": { "ProjectId": 4191152  } } }  },
  "from": 0,  "size": 50,
  "sort": [],  "facets": {}
}

What am I misunderstanding? I've got 80M documents, 30 of which match this 
query, so the only thing I can guess is that somehow when I don't use a "query" 
element at the root, Elasticsearch retrieves every document and applies my 
filter, versus using some indexed approach when using query.

-Michael

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/BLUPR07MB674B6F4B405F739E034FB1AD4330%40BLUPR07MB674.namprd07.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to