You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tests.rs
    path of file: ./repos/vector/src/sinks/elasticsearch
    
    the code of the file until where you have to start completion: use std::convert::TryFrom;

use vector_lib::lookup::PathPrefix;

use crate::{
    codecs::Transformer,
    event::{LogEvent, Metric, MetricKind, MetricValue, ObjectMap, Value},
    sinks::{
        elasticsearch::{
            sink::process_log, BulkAction, BulkConfig, DataStreamConfig, ElasticsearchApiVersion,
            ElasticsearchCommon, ElasticsearchConfig, ElasticsearchMode,
        },
        util::encoding::Encoder,
    },
    template::Template,
};

// helper to unwrap template strings for tests only
fn parse_template(input: &str) -> Template {
    Template::try_from(input).unwrap()
}

#[tokio::test]
async fn sets_create_action_when_configured() {
    use chrono::{TimeZone, Utc};

    use crate::config::log_schema;

    let config = ElasticsearchConfig {
        bulk: BulkConfig {
            action: parse_template("{{ action }}te"),
            index: parse_template("vector"),
        },
        endpoints: vec![String::from("https://example.com")],
        api_version: ElasticsearchApiVersion::V6,
        ..Default::default()
    };
    let es = E
    
async fn sets_create_action_when_configured() {
    use chrono::{TimeZone, Utc};

    use crate::config::log_schema;

    let config = ElasticsearchConfig {
        bulk: BulkConfig {
            action: parse_template("{{ action }}te"),
            index: parse_template("vector"),
        },
        endpoints: vec![String::from("https://example.com")],
        api_version: ElasticsearchApiVersion::V6,
        ..Default::default()
    };
    let es = ElasticsearchCommon::parse_single(&config).await.unwrap();

    let mut log = LogEvent::from("hello there");
    log.insert(
        (PathPrefix::Event, log_schema().timestamp_key().unwrap()),
        Utc.with_ymd_and_hms(2020, 12, 1, 1, 2, 3)
            .single()
            .expect("invalid timestamp"),
    );
    log.insert("action", "crea");

    let mut encoded = vec![];
    let (encoded_size, _json_size) = es
        .request_builder
        .encoder
        .encode_input(
            vec![process_log(log, &es.mode, None, &config.encoding).unwrap()],
            &mut encoded,
        )
        .unwrap();

    let expected = r#"{"create":{"_index":"vector","_type":"_doc"}}
{"action":"crea","message":"hello there","timestamp":"2020-12-01T01:02:03Z"}
"#;
    assert_eq!(std::str::from_utf8(&encoded).unwrap(), expected);
    assert_eq!(encoded.len(), encoded_size);
}