Class TopQueriesService
java.lang.Object
org.opensearch.plugin.insights.core.service.TopQueriesService
Service responsible for gathering and storing top N queries
with high latency or resource usage
- Opensearch.internal:
-
Method Summary
Modifier and TypeMethodDescriptionintGet the current configured top n sizeGet the current top queries snapshot from the AtomicReference.getTopQueriesRecords(boolean includeLastWindow) Get all top queries records that are in the current top n queries store Optionally include top N records from the last window.voidsetEnabled(boolean enabled) Set enable flag for the servicevoidsetTopNSize(int topNSize) Set the top N size for TopQueriesService service.voidsetWindowSize(TimeValue windowSize) Set the window size for top N queries servicevoidvalidateTopNSize(int size) Validate the top N size based on the internal constrainsvoidvalidateWindowSize(TimeValue windowSize) Validate if the window size is valid, based on internal constrains.
-
Method Details
-
setTopNSize
public void setTopNSize(int topNSize) Set the top N size for TopQueriesService service.- Parameters:
topNSize- the top N size to set
-
getTopNSize
public int getTopNSize()Get the current configured top n size- Returns:
- top n size
-
validateTopNSize
public void validateTopNSize(int size) Validate the top N size based on the internal constrains- Parameters:
size- the wanted top N size
-
setEnabled
public void setEnabled(boolean enabled) Set enable flag for the service- Parameters:
enabled- boolean
-
setWindowSize
Set the window size for top N queries service- Parameters:
windowSize- window size to set
-
validateWindowSize
Validate if the window size is valid, based on internal constrains.- Parameters:
windowSize- the window size to validate
-
getTopQueriesRecords
public List<SearchQueryRecord> getTopQueriesRecords(boolean includeLastWindow) throws IllegalArgumentException Get all top queries records that are in the current top n queries store Optionally include top N records from the last window. By default, return the records in sorted order.- Parameters:
includeLastWindow- if the top N queries from the last window should be included- Returns:
- List of the records that are in the query insight store
- Throws:
IllegalArgumentException- if query insight is disabled in the cluster
-
getTopQueriesCurrentSnapshot
Get the current top queries snapshot from the AtomicReference.- Returns:
- a list of
SearchQueryRecord
-