Why sorting elasticserch in my example is to slow

Hey,

I cant find anywhere answer why elasticsearch in my example is to slow.

So lets see to my mapping:

mappings": { "auctions": { "_all": { "enabled": false }, "properties": { "cat": { "store": true, "type": "long" }, "curr": { "index": "not_analyzed", "store": true, "type": "string" }, "end_date": { "store": true, "type": "long" }, "price": { "store": true, "type": "long" }, "start_date": { "store": true, "type": "long" }, "tcat": { "store": true, "type": "long" }, "title": { "store": true, "type": "string" }, "uid": { "store": true, "type": "long" } } }, "trans": { "_all": { "enabled": false }, "properties": { "buyer": { "store": true, "type": "long" }, "cat": { "store": true, "type": "long" }, "comment_text": { "store": true, "type": "string" }, "comment_type": { "store": true, "type": "long" }, "item": { "store": true, "type": "long" }, "price": { "store": true, "type": "long" }, "seller": { "store": true, "type": "long" }, "title": { "store": true, "type": "string" }, "tree_cat": { "store": true, "type": "long" }, "ts": { "store": true, "type": "long" } } }
When I try sort by any field its continues , continues ,continues and continues and cant stop.

Any suggestions what incorrect?

If you want see more code please tell I will try to show.

What does your query look like?

private NativeSearchQueryBuilder getSearchQuery(Boolean hasComments, TransIndexSearchParams searchParams, Pageable pageable) {
        boolean issetPriceFrom = Optional.ofNullable(searchParams.getPriceFrom()).isPresent();
        boolean issetPriceTo = Optional.ofNullable(searchParams.getPriceTo()).isPresent();

        final List<FilterBuilder> filters = Lists.newArrayList();
        final NativeSearchQueryBuilder searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery());

        Optional.ofNullable(searchParams.getBuyer()).ifPresent(v -> filters.add(boolFilter().must(termFilter("buyer", v))));
        Optional.ofNullable(searchParams.getCat()).ifPresent(v -> filters.add(boolFilter().must(termFilter("cat", v))));
        Optional.ofNullable(searchParams.getComment_type()).ifPresent(v -> filters.add(boolFilter().must(termFilter("comment_type", v))));
        Optional.ofNullable(searchParams.getItem()).ifPresent(v -> filters.add(boolFilter().must(termFilter("item", v))));
        Optional.ofNullable(searchParams.getSeller()).ifPresent(v -> filters.add(boolFilter().must(termFilter("seller", v))));
        Optional.ofNullable(searchParams.getTree_cat()).ifPresent(v -> filters.add(boolFilter().must(termFilter("tree_cat", v))));

        final BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();

        //access for many sellers
        if (searchParams.getSellers() != null) {
            if (searchParams.getTitle() != null || searchParams.getComment_text() != null) {
                Optional.ofNullable(searchParams.getSellers().split(",")).ifPresent(v -> {
                    filters.add(boolFilter().must(termsFilter("seller", v)));
                });
            } else {
                for (String user : searchParams.getSellers().split(",")) {
                    boolQueryBuilder.should(queryStringQuery(user).field("seller"));
                }
            }
        }

        //access for many categories
        if (searchParams.getCats() != null) {
            Optional.ofNullable(searchParams.getCats().split(",")).ifPresent(v -> {
                filters.add(boolFilter().must(termsFilter("cat", v)));
            });
        }
        if (Optional.ofNullable(searchParams.getTitle()).isPresent()) {
            boolQueryBuilder.must(queryStringQuery(searchParams.getTitle()).analyzeWildcard(true).field("title"));
        }

        if (Optional.ofNullable(searchParams.getComment_text()).isPresent()) {
            boolQueryBuilder.must(queryStringQuery(searchParams.getComment_text()).analyzeWildcard(true).field("comment_text"));
        }

        if (issetPriceFrom || issetPriceTo) {
            filters.add(rangeFilter("price").from(searchParams.getPriceFrom()).to(searchParams.getPriceTo()));
        }

        if (Optional.ofNullable(searchParams.getTsFrom()).isPresent()
                || Optional.ofNullable(searchParams.getTsTo()).isPresent()) {
            filters.add(rangeFilter("ts").from(searchParams.getTsFrom()).to(searchParams.getTsTo()));
        }

        if (hasComments != null && hasComments.equals(true)) {
            filters.add(FilterBuilders.boolFilter().must(FilterBuilders.existsFilter("comment_text")));
        }

        if (hasComments != null && hasComments.equals(false)) {
            filters.add(FilterBuilders.boolFilter().must(FilterBuilders.missingFilter("comment_text")));
        }

        searchQuery.withQuery(boolQueryBuilder);
        FilterBuilder[] filterArr = new FilterBuilder[filters.size()];
        filterArr = filters.toArray(filterArr);
        searchQuery.withFilter(andFilter(filterArr));

        if (pageable != null) {
            searchQuery.withPageable(pageable);
        }
        return searchQuery;
    }

boolQuery is fast but filters not.