rs-es icon indicating copy to clipboard operation
rs-es copied to clipboard

meet Err("missing field `created` ) when insert document.

Open yaanhyy opened this issue 4 years ago • 0 comments

Use the re-es like this, insert action success, but response say: Err("missing field created ):

pub fn insert_event(client: &mut Client, event_index: &str, event: event) -> Result<(), String>{
        let id = format!("{}{}", event.block_hash, event.extrinsic_index).as_str().to_string();
        let res = client
            .index(event_index, "event")
            .with_id(&id)
            .with_doc(&event)
            .with_op_type(OpType::Create)
            .send();
        match res {
            Ok(_) =>  return Ok(()),
            Err(e) => return Err(e.to_string()),
        }
    }

es info:

{
  "name" : "w7RhYin",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "7qlVzhX-TXC6MVkp7D5O0w",
  "version" : {
    "number" : "6.8.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "65b6179",
    "build_date" : "2019-05-15T20:06:13.172855Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

yaanhyy avatar Mar 20 '20 02:03 yaanhyy