manticore_openapi/models/
insert_document_request.rs

1/*
2 * Manticore Search Client
3 *
4 * Сlient for Manticore Search.
5 *
6 * The version of the OpenAPI document: 3.3.1
7 * Contact: info@manticoresearch.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// InsertDocumentRequest : Object with document data.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InsertDocumentRequest {
17    /// Name of the index
18    #[serde(rename = "index")]
19    pub index: String,
20    /// cluster name
21    #[serde(rename = "cluster", skip_serializing_if = "Option::is_none")]
22    pub cluster: Option<String>,
23    /// Document ID.
24    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
25    pub id: Option<u64>,
26    /// Object with document data
27    #[serde(rename = "doc")]
28    pub doc: std::collections::HashMap<String, serde_json::Value>,
29}
30
31impl InsertDocumentRequest {
32    /// Object with document data.
33    pub fn new(
34        index: String,
35        doc: std::collections::HashMap<String, serde_json::Value>,
36        id: Option<u64>,
37    ) -> InsertDocumentRequest {
38        InsertDocumentRequest {
39            index,
40            cluster: None,
41            id,
42            doc,
43        }
44    }
45}