Query is slow!

My query hits too many results,and I just need any ten terms,but elasticsearch will sort all the hited terms by relevancy.
Is there a method I can forbidden this feature?

Look into using filter instead of query? You might want something like https://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-terms-filter.html

Thank you for your answer.I think the sort process is after the query and the filter, I want forbidden it.

Filter is not sorted by relevance, query is.

the sort process is after query and filters before return results.that is query&filter -> sort -> return results.

Please have you tried a filter? Filter does not score relevance. Are you running vs an analyzed or non analyzed field?


I had tried it on analyzed field,but slowly too.the more docs the query&filter htis, the slower the query&filter.But I only want ten docs it hits,so I think the time is constant.

It depends on what you're trying to do. Are you basically trying to do a search for basically key=value?

e.g. request.verb: "HEAD"?

Then you can maybe use a non-analyzed field and a term filter. If you're trying to do some search against an analyzed field your options for speeding up query may be more limited besides throwing more resource at the search.

If you could paste your exact query (or some general form) would be a lot more helpful.

Wrapping the query in a constant score query will provide a uniform score,
but you will have no control over what elements will appear in the top 10.
It is not like a RDBMS where the rows are returned by their place in the