Does early termination (sorted index) kick in in this case?

I have such an index (ES 7.4):

    "index": {
        "sort.field": "date",
        "sort.order": "desc",

And I query like this:

    {
    "sort": [
        "_score",
        {
            "date": {
                "order": "desc"
            }
        }
    ],
    "track_total_hits": false,
    "query": {
                    "multi_match": {
                        "query": "banana",
                        "fields": [
                            "title^2"                     
                        ]
                    }
        }
    }
    }

And important detail, title field is like this:

            "title": {
                "type": "text",
                "analyzer": "custom_text",
                "search_analyzer": "custom_search",
                "similarity": "boolean"
            },

so its using boolean similarity. As such max score for docs will be 2 (boost value). Even if we sort by score first, by date later, as the max score is known, early termination could be used here. But I cannot assert by looking at my experiments, as I have only a very small index to test.

So, is it being used?

thanks

If you sort by score, then index sorting will not apply.

What could however still apply is the block max-WAND. See https://www.elastic.co/blog/faster-retrieval-of-top-hits-in-elasticsearch-with-block-max-wand

ok, makes sense...

Yeah, max-WAND would apply but this would happen even if the index was date-sorted.

thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.