Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] query_group_hashcode is not present in the top_queries response in some cases #186

Closed
deshsidd opened this issue Jan 14, 2025 · 2 comments · Fixed by #187
Closed
Assignees
Labels
bug Something isn't working

Comments

@deshsidd
Copy link
Collaborator

What is the bug?

A clear and concise description of the bug.
query_group_hashcode is not present in the top_queries response in some cases when the from request param is specified.

How can one reproduce the bug?

Steps to reproduce the behavior.

  1. Configure Top N grouping and local index exporter

  2. GET {{BASE_URL}}/_insights/top_queries?type=latency&from=2025-01-13T19%3A56%3A39.870Z&to=2025-01-14T19%3A56%3A39.870Z

{
    "top_queries": [
        {
            "timestamp": 1736883631440,
            "labels": {},
            "node_id": "nVSP4I1VRTutynXSQlc5Kw",
            "total_shards": 1,
            "group_by": "SIMILARITY",
            "search_type": "query_then_fetch",
            "phase_latency_map": {
                "expand": 0,
                "query": 29,
                "fetch": 0
            },
            "source": {
                "query": {
                    "match": {
                        "name": {
                            "query": "John",
                            "operator": "OR",
                            "prefix_length": 0,
                            "max_expansions": 50,
                            "fuzzy_transpositions": true,
                            "lenient": false,
                            "zero_terms_query": "NONE",
                            "auto_generate_synonyms_phrase_query": true,
                            "boost": 1.0
                        }
                    }
                }
            },
            "indices": [
                "my-index"
            ],
            "task_resource_usages": [
                {
                    "action": "indices:data/read/search[phase/query]",
                    "taskId": 504,
                    "parentTaskId": 503,
                    "nodeId": "nVSP4I1VRTutynXSQlc5Kw",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 17492000,
                        "memory_in_bytes": 2202736
                    }
                },
                {
                    "action": "indices:data/read/search",
                    "taskId": 503,
                    "parentTaskId": -1,
                    "nodeId": "nVSP4I1VRTutynXSQlc5Kw",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 837000,
                        "memory_in_bytes": 93336
                    }
                }
            ],
            "measurements": {
                "memory": {
                    "number": 2377288,
                    "count": 3,
                    "aggregationType": "AVERAGE"
                },
                "latency": {
                    "number": 57,
                    "count": 3,
                    "aggregationType": "AVERAGE"
                },
                "cpu": {
                    "number": 23795000,
                    "count": 3,
                    "aggregationType": "AVERAGE"
                }
            }
        }
    ]
}
  1. GET {{BASE_URL}}/_insights/top_queries?type=latency
{
    "top_queries": [
        {
            "timestamp": 1736885278221,
            "query_group_hashcode": "4a143d80e2b7caff22142e4cadd540d3",
            "labels": {},
            "node_id": "nVSP4I1VRTutynXSQlc5Kw",
            "total_shards": 1,
            "group_by": "SIMILARITY",
            "search_type": "query_then_fetch",
            "phase_latency_map": {
                "expand": 0,
                "query": 962,
                "fetch": 0
            },
            "source": {
                "query": {
                    "bool": {
                        "must": [
                            {
                                "range": {
                                    "timestamp": {
                                        "from": 1736798199870,
                                        "to": 1736884599870,
                                        "include_lower": true,
                                        "include_upper": true,
                                        "boost": 1.0
                                    }
                                }
                            }
                        ],
                        "must_not": [
                            {
                                "match": {
                                    "indices": {
                                        "query": "top_queries*",
                                        "operator": "OR",
                                        "prefix_length": 0,
                                        "max_expansions": 50,
                                        "fuzzy_transpositions": true,
                                        "lenient": false,
                                        "zero_terms_query": "NONE",
                                        "auto_generate_synonyms_phrase_query": true,
                                        "boost": 1.0
                                    }
                                }
                            }
                        ],
                        "adjust_pure_negative": true,
                        "boost": 1.0
                    }
                }
            },
            "indices": [
                "top_queries-2025.01.14-62083"
            ],
            "task_resource_usages": [
                {
                    "action": "indices:data/read/search[phase/query]",
                    "taskId": 4469,
                    "parentTaskId": 4468,
                    "nodeId": "nVSP4I1VRTutynXSQlc5Kw",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 1060000,
                        "memory_in_bytes": 75728
                    }
                },
                {
                    "action": "indices:data/read/search",
                    "taskId": 4468,
                    "parentTaskId": -1,
                    "nodeId": "nVSP4I1VRTutynXSQlc5Kw",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 76000,
                        "memory_in_bytes": 3704
                    }
                }
            ],
            "measurements": {
                "memory": {
                    "number": 79432,
                    "count": 1,
                    "aggregationType": "AVERAGE"
                },
                "latency": {
                    "number": 962,
                    "count": 1,
                    "aggregationType": "AVERAGE"
                },
                "cpu": {
                    "number": 1136000,
                    "count": 1,
                    "aggregationType": "AVERAGE"
                }
            }
        }
    ]
}

What is the expected behavior?

A clear and concise description of what you expected to happen.

query_group_hashcode should be visible even when ?from param is specified.

What is your host/environment?

Operating system, version.

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Add any other context about the problem.

@deshsidd deshsidd added bug Something isn't working untriaged labels Jan 14, 2025
@deshsidd deshsidd self-assigned this Jan 14, 2025
@ansjcy
Copy link
Member

ansjcy commented Jan 14, 2025

@ansjcy ansjcy removed the untriaged label Jan 14, 2025
@deshsidd
Copy link
Collaborator Author

Yup, already fixed this in my latest. Created the bug for tracking purposes. Will send out the PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants