From Python to Rust

Hi all,

I'm a newbie with Python and Elasticsearch.
I'm trying to create a client from host, username and password.

With Python, the original code is:

Elasticsearch(
            hosts=hosts,
            http_auth=(es_username, es_password),
            use_ssl=True,
            verify_certs=False,
            ssl_show_warn=False,
            timeout=600,
        )

For the moment, I transform it to:

Elasticsearch::new(
            TransportBuilder::new(SingleNodeConnectionPool::new(Url::parse(&host)?))
                .timeout(Duration::from_secs(600))
                .auth(elasticsearch::auth::Credentials::Basic(u, p))
                .build()?,
        )

Even with the document, I'm unable to understand how to adapt use_ssl=True, verify_certs=False, ssl_show_warn=False.

Could someone help me ?

Regards

I do not use Rust, but on the documentation, there is an example for when you do not want to verify the certificates.

It seems that you just need to add .cert_validation(CertificateValidation::None) to your TransportBuilder

Not sure if the other options, use_ssl and ssl_show_warn are needed or have equivalents.

Thanks
I'm stupid, I used elasticsearch = { version = "7.17.7-alpha.1", default-features = false }
It's why I didn't success to use cert_validation.
Now, I'm looking for ssl.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.