pub struct PercentilesAggregationReq {
    pub field: String,
    pub percents: Option<Vec<f64>>,
    pub keyed: bool,
    pub missing: Option<f64>,
}
Expand description

§Percentiles

The percentiles aggregation is a useful tool for understanding the distribution of a data set. It calculates the values below which a given percentage of the data falls. For instance, the 95th percentile indicates the value below which 95% of the data points can be found.

This aggregation can be particularly interesting for analyzing website or service response times. For example, if the 95th percentile website load time is significantly higher than the median, this indicates that a small percentage of users are experiencing much slower load times than the majority.

To use the percentiles aggregation, you’ll need to provide a field to aggregate on. In the case of website load times, this would typically be a field containing the duration of time it takes for the site to load.

The following example demonstrates a request for the percentiles of the “load_time” field:

{
    "percentiles": {
        "field": "load_time"
    }
}

This request will return an object containing the default percentiles (1, 5, 25, 50 (median), 75, 95, and 99). You can also customize the percentiles you want to calculate by providing an array of values in the “percents” parameter:

{
    "percentiles": {
        "field": "load_time",
        "percents": [10, 20, 30, 40, 50, 60, 70, 80, 90]
    }
}

In this example, the aggregation will return the 10th, 20th, 30th, 40th, 50th, 60th, 70th, 80th, and 90th percentiles of the “load_time” field.

Analyzing the percentiles of website load times can help you understand the user experience and identify areas for optimization. For example, if the 95th percentile load time is significantly higher than the median, this indicates that a small percentage of users are experiencing much slower load times than the majority.

§Estimating Percentiles

While percentiles provide valuable insights into the distribution of data, it’s important to understand that they are often estimates. This is because calculating exact percentiles for large data sets can be computationally expensive and time-consuming. As a result, many percentile aggregation algorithms use approximation techniques to provide faster results.

Fields§

§field: String

The field name to compute the percentiles on.

§percents: Option<Vec<f64>>

The percentiles to compute. Defaults to [1.0, 5.0, 25.0, 50.0, 75.0, 95.0, 99.0]

§keyed: bool

Whether to return the percentiles as a hash map

§missing: Option<f64>

The missing parameter defines how documents that are missing a value should be treated. By default they will be ignored but it is also possible to treat them as if they had a value. Examples in JSON format: { “field”: “my_numbers”, “missing”: “10.0” }

Implementations§

source§

impl PercentilesAggregationReq

source

pub fn from_field_name(field_name: String) -> Self

Creates a new PercentilesAggregationReq instance from a field name.

source

pub fn field_name(&self) -> &str

Returns the field name the aggregation is computed on.

Trait Implementations§

source§

impl Clone for PercentilesAggregationReq

source§

fn clone(&self) -> PercentilesAggregationReq

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PercentilesAggregationReq

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for PercentilesAggregationReq

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for PercentilesAggregationReq

source§

fn eq(&self, other: &PercentilesAggregationReq) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for PercentilesAggregationReq

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for PercentilesAggregationReq

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Fruit for T
where T: Send + Downcast,