Class SearchQueryRecord
java.lang.Object
org.opensearch.plugin.insights.rules.model.SearchQueryRecord
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.Writeable,org.opensearch.core.xcontent.ToXContent,org.opensearch.core.xcontent.ToXContentObject
public class SearchQueryRecord
extends Object
implements org.opensearch.core.xcontent.ToXContentObject, org.opensearch.core.common.io.stream.Writeable
SearchQueryRecord represents a minimal atomic record stored in the Query Insight Framework,
which contains extensive information related to a search query.
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionSearchQueryRecord(long timestamp, Map<MetricType, Number> measurements, Map<Attribute, Object> attributes) Constructor of SearchQueryRecordSearchQueryRecord(org.opensearch.core.common.io.stream.StreamInput in) Constructor of SearchQueryRecord -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(Attribute attribute, Object value) Add an attribute to this recordstatic intcompare(SearchQueryRecord a, SearchQueryRecord b, MetricType metricType) Compare two SearchQueryRecord, based on the given MetricTypebooleanCheck if a SearchQueryRecord is deep equal to another recordReturns a map of the attributes associated with the metric.getMeasurement(MetricType name) Returns the measurement associated with the specified name.Returns a map of all the measurements associated with the metric.longReturns the observation time of the metric.inthashCode()org.opensearch.core.xcontent.XContentBuildertoXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) voidwriteTo(org.opensearch.core.common.io.stream.StreamOutput out) Write a SearchQueryRecord to a StreamOutputMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
SearchQueryRecord
public SearchQueryRecord(org.opensearch.core.common.io.stream.StreamInput in) throws IOException, ClassCastException Constructor of SearchQueryRecord- Parameters:
in- the StreamInput to read the SearchQueryRecord from- Throws:
IOException- IOExceptionClassCastException- ClassCastException
-
SearchQueryRecord
public SearchQueryRecord(long timestamp, Map<MetricType, Number> measurements, Map<Attribute, Object> attributes) Constructor of SearchQueryRecord- Parameters:
timestamp- The timestamp of the query.measurements- A list of Measurement associated with this queryattributes- A list of Attributes associated with this query
-
-
Method Details
-
getTimestamp
public long getTimestamp()Returns the observation time of the metric.- Returns:
- the observation time in milliseconds
-
getMeasurement
Returns the measurement associated with the specified name.- Parameters:
name- the name of the measurement- Returns:
- the measurement object, or null if not found
-
getMeasurements
Returns a map of all the measurements associated with the metric.- Returns:
- a map of measurement names to measurement objects
-
getAttributes
Returns a map of the attributes associated with the metric.- Returns:
- a map of attribute keys to attribute values
-
addAttribute
Add an attribute to this record- Parameters:
attribute- attribute to addvalue- the value associated with the attribute
-
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.opensearch.core.xcontent.ToXContent- Throws:
IOException
-
writeTo
Write a SearchQueryRecord to a StreamOutput- Specified by:
writeToin interfaceorg.opensearch.core.common.io.stream.Writeable- Parameters:
out- the StreamOutput to write- Throws:
IOException- IOException
-
compare
Compare two SearchQueryRecord, based on the given MetricType- Parameters:
a- the first SearchQueryRecord to compareb- the second SearchQueryRecord to comparemetricType- the MetricType to compare on- Returns:
- 0 if the first SearchQueryRecord is numerically equal to the second SearchQueryRecord; -1 if the first SearchQueryRecord is numerically less than the second SearchQueryRecord; 1 if the first SearchQueryRecord is numerically greater than the second SearchQueryRecord.
-
equals
Check if a SearchQueryRecord is deep equal to another record -
hashCode
public int hashCode()
-