Understanding extremely slow rewrite_time due to fuzziness

I'm managing a relatively large ES cluster and I'm struggling to understand why I'm seeing such large rewrite_time on searches of more than a few tokens.

For this nonsense query "djkh hjk hjk hjkh jhkj jhjk jkh jewrh" I'm seeing response times above 1s (1164ms took in one sample), with almost all of that in rewrite_time (1075932550ns / 1.08s in one test query). If I take away "fuzziness:AUTO," on two match clauses in the query, the took time drops below 100ms!!!

I am struggling to understand why fuzziness rewriting time is so high. What other metrics can/should I be looking at?

Thanks,
David

Here's the current full query

{
        "from": 0,
        "size": 20,
        "query": {
            "boosting": {
                "positive": {
                    "bool": {
                        "must": {
                            "function_score": {
                                "query": {
                                    "dis_max": {
                                        "queries": [
                                            {
                                                "match": {
                                                    "text": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "fuzziness": "AUTO",
                                                        "operator": "and",
                                                        "_name": "match:text"
                                                    }
                                                }
                                            },
                                            {
                                                "match": {
                                                    "pathText": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "fuzziness": "AUTO",
                                                        "operator": "and",
                                                        "boost": 0.25,
                                                        "_name": "match:pathText"
                                                    }
                                                }
                                            },
                                            {
                                                "match_phrase": {
                                                    "text": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "boost": 2,
                                                        "_name": "match_phrase:text"
                                                    }
                                                }
                                            },
                                            {
                                                "match_phrase": {
                                                    "pathText": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "boost": 0.25,
                                                        "_name": "match_phrase:pathText"
                                                    }
                                                }
                                            },
                                            {
                                                "match_phrase_prefix": {
                                                    "text": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "_name": "match_phrase_prefix:text"
                                                    }
                                                }
                                            },
                                            {
                                                "match_phrase_prefix": {
                                                    "pathText": {
                                                        "query": "djkh hjk hjk hjkh jhkj jhjk jkh jewrh",
                                                        "boost": 0.25,
                                                        "_name": "match_phrase_prefix:pathText"
                                                    }
                                                }
                                            }
                                        ]
                                    }
                                },
                                "exp": {
                                    "lastEditedTime": {
                                        "decay": 0.01,
                                        "scale": "217107247125ms"
                                    }
                                }
                            }
                        },
                        "should": [
                            {
                                "term": {
                                    "isTopLevel": {
                                        "value": true,
                                        "boost": 1.5
                                    }
                                }
                            },
                            {
                                "term": {
                                    "isNavigable": {
                                        "value": true,
                                        "boost": 5
                                    }
                                }
                            }
                        ],
                        "filter": [
                            {
                                "term": {
                                    "spaceId": "XXXXXXXXXXX"
                                }
                            },
                            {
                                "bool": {
                                    "must_not": {
                                        "term": {
                                            "permissions.deleted": {
                                                "value": true
                                            }
                                        }
                                    },
                                    "should": [
                                        {
                                            "term": {
                                                "permissions.space": {
                                                    "value": true
                                                }
                                            }
                                        },
                                        {
                                            "term": {
                                                "permissions.userIds": {
                                                    "value": "XXXXXXXXXXX"
                                                }
                                            }
                                        }
                                    ],
                                    "minimum_should_match": 1,
                                    "boost": 0
                                }
                            },
                            {
                                "term": {
                                    "isDeleted": false
                                }
                            },
                            {
                                "exists": {
                                    "field": "text"
                                }
                            }
                        ],
                        "must_not": [
                            {
                                "term": {
                                    "type": "copy_indicator"
                                }
                            }
                        ]
                    }
                },
                "negative": {
                    "bool": {
                        "must": [
                            {
                                "term": {
                                    "type": "page"
                                }
                            },
                            {
                                "term": {
                                    "hasContent": {
                                        "value": false
                                    }
                                }
                            }
                        ]
                    }
                },
                "negative_boost": 0.5
            }
        },
        "highlight": {
            "pre_tags": [
                "<gzkNfoUU>"
            ],
            "post_tags": [
                "</gzkNfoUU>"
            ],
            "fragment_size": 500,
            "number_of_fragments": 1,
            "fields": {
                "text": {},
                "pathText": {}
            }
        },
        "sort": "_score",
        "profile": true
    }

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