aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parse.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/parse.rs b/src/parse.rs
index 10216f7..8f0ddea 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -115,7 +115,7 @@ pub struct SearchBody {
// https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html
#[serde(skip_serializing_if = "Option::is_none")]
- pub sort: Option<Vec<SortElement>>,
+ pub sort: Option<SortSingleOrVec>,
#[serde(skip_serializing_if = "Option::is_none")]
pub slice: Option<ApiSlice>,
@@ -282,6 +282,14 @@ pub enum SortElement {
#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
+pub enum SortSingleOrVec {
+ Single(String),
+ Vec(Vec<SortElement>),
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+#[serde(deny_unknown_fields)]
+#[serde(untagged)]
pub enum DocValOrString {
String(String),
Object {
@@ -638,7 +646,7 @@ pub struct InnerHits {
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
- sort: Option<Vec<SortElement>>,
+ sort: Option<SortSingleOrVec>,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]