简体   繁体   中英

ElasticSearch poor query performance one 100K documents dataset

I'm using the default dynamic mapping on ElasticSearch, and calling the search method over the Java API as follow:

    response = client.prepareSearch("test")
    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
    .setQuery(QueryBuilders.queryStringQuery(query)) 
    .setFrom(0).setSize(1000).setExplain(false)
    .execute().actionGet();

After several optimizations on memory issues, including the heap size, disable swapping, the performance is very bad comparing with other engines. For instance, the query "Name:*" takes almost 2 minutes to perform. What can i do to improve significantly the performance? The documents are very small with almost 1 token for each field.

My problem was on the query type used. QueryStringQuery checks every single field from one document. By using a matchQuery the performance increased allot. Thanks for the helpful comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM