opensearch-project/query-insights

[FEATURE] Add shardID to Top N response

Open

#250 opened on Feb 27, 2025

 (2 comments) (0 reactions) (0 assignees)Java (34 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (27 stars)
PR merge metrics
 (PR metrics pending)

Description

Is your feature request related to a problem?

A clear and concise description of what the problem is, e.g. I'm always frustrated when [...]. Currently, we have the shardID information but do not display this in the top N response

Example response:

{
    "top_queries": [
        {
            "timestamp": 1740612800519,
            "id": "94149c36-17f6-4a15-bb3e-9e687bd15119",
            "phase_latency_map": {
                "expand": 0,
                "query": 1,
                "fetch": 0
            },
            "indices": [
                "top_queries-2025.02.25-91906"
            ],
            "node_id": "xYmKX-wITrWIXn6Dt1XSrQ",
            "labels": {
                "X-Opaque-Id": "c4e6143f-155c-4e41-86f5-a5cdac040330"
            },
            "group_by": "SIMILARITY",
            "query_group_hashcode": "d4e0e36107e824bae11fab026a1238f2",
            "search_type": "query_then_fetch",
            "total_shards": 1,
            "task_resource_usages": [
                {
                    "action": "indices:data/read/search[phase/query]",
                    "taskId": 1820361,
                    "parentTaskId": 1820358,
                    "nodeId": "xYmKX-wITrWIXn6Dt1XSrQ",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 827000,
                        "memory_in_bytes": 168144
                    }
                },
                {
                    "action": "indices:data/read/search",
                    "taskId": 1820358,
                    "parentTaskId": -1,
                    "nodeId": "xYmKX-wITrWIXn6Dt1XSrQ",
                    "taskResourceUsage": {
                        "cpu_time_in_nanos": 78000,
                        "memory_in_bytes": 3592
                    }
                }
            ],
            "source": {
                "size": 1000,
                "query": {
                    "bool": {
                        "must": [
                            {
                                "range": {
                                    "timestamp": {
                                        "from": 1740526199307,
                                        "to": 1740612599307,
                                        "include_lower": true,
                                        "include_upper": true,
                                        "boost": 1.0
                                    }
                                }
                            },
                            {
                                "match": {
                                    "id": {
                                        "query": "3653b201-cecc-498c-9b51-6b2323635110",
                                        "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
                                    }
                                }
                            }
                        ],
                        "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
                    }
                }
            },
            "measurements": {
                "memory": {
                    "number": 1160560,
                    "count": 6,
                    "aggregationType": "AVERAGE"
                },
                "latency": {
                    "number": 2042,
                    "count": 6,
                    "aggregationType": "AVERAGE"
                },
                "cpu": {
                    "number": 6996000,
                    "count": 6,
                    "aggregationType": "AVERAGE"
                }
            }
        }
    ]
}

What solution would you like?

A clear and concise description of what you want to happen. Add shardID as part of the task_resource_usages in the above.

What alternatives have you considered?

A clear and concise description of any alternative solutions or features you've considered.

Do you have any additional context?

Add any other context or screenshots about the feature request here.

Contributor guide