Struct InnerHits

Source
pub struct InnerHits { /* private fields */ }
Expand description

The parent-join and nested features allow the return of documents that have matches in a different scope. In the parent/child case, parent documents are returned based on matches in child documents or child documents are returned based on matches in parent documents. In the nested case, documents are returned based on matches in nested inner objects.

In both cases, the actual matches in the different scopes that caused a document to be returned are hidden. In many cases, it’s very useful to know which inner nested objects (in the case of nested) or children/parent documents (in the case of parent/child) caused certain information to be returned. The inner hits feature can be used for this. This feature returns per search hit in the search response additional nested hits that caused a search hit to match in a different scope.

Inner hits can be used by defining an inner_hits definition on a nested, has_child or has_parent query and filter.

https://www.elastic.co/guide/en/elasticsearch/reference/current/inner-hits.html

Implementations§

Source§

impl InnerHits

Source

pub fn new() -> Self

Creates a new instance of InnerHits

Source

pub fn source<T>(self, source: T) -> Self
where T: Into<SourceFilter>,

Indicates which source fields are returned for matching documents

Source

pub fn name<T>(self, name: T) -> Self
where T: ToString,

Inner hit name, useful when multiple inner_hits exist in a single search request

Source

pub fn from(self, from: u64) -> Self

Starting document offset.

Defaults to 0.

Source

pub fn size(self, size: u64) -> Self

The number of hits to return.

Defaults to 10.

Source

pub fn sort<T>(self, sort: T) -> Self
where T: IntoIterator, T::Item: Into<Sort>,

A collection of sorting fields

Source

pub fn highlight<T>(self, highlight: T) -> Self
where T: Into<Highlight>,

Highlight

Source

pub fn docvalue_fields<T>(self, docvalue_fields: T) -> Self
where T: IntoIterator, T::Item: ToString,

A collection of docvalue fields

Source

pub fn collapse<T>(self, collapse: T) -> Self
where T: ToString,

A field to collapse by

Trait Implementations§

Source§

impl Clone for InnerHits

Source§

fn clone(&self) -> InnerHits

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 InnerHits

Source§

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

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

impl Default for InnerHits

Source§

fn default() -> InnerHits

Returns the “default value” for a type. Read more
Source§

impl PartialEq for InnerHits

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for InnerHits

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 InnerHits

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.