"highlight" in query cause long delay

Use ElasticSearch 5.4.1.
I have a query on a small index (about 30k documents) that takes over one second in search time. I find that once I remove the "highlight" block, the search time is down to about 50ms!
"highlight": {
"pre_tags": [""],
"post_tags": ["
"],
"fields": {
"my_search_field": {}
}
}

More info: 15 total results. Query "size" is 10. I reduced "size" to 4, 6, etc, the search time do come down proportionally. "my_search_field" is not huge, and even if it is the default "fragment_size" should prevent Elastic from going through all of it anyway.

Any idea why it takes so long? Thanks.

Answer it myself. Changed to "postings highlighter" after reading document https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html#postings-highlighter. The performance improved a lot (~250ms from over 1 second). Still a lot more than without highlighter (~50ms).

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