#[cfg(doctest)]
#[doc = include_str!("../README.md")]
pub struct ReadmeDoctests;
pub mod catalog;
pub mod client;
pub mod exec;
pub mod pushdown;
pub mod schema;
pub mod table;
#[cfg(feature = "udf")]
pub mod udf;
pub use catalog::OpenSearchSchemaProvider;
pub use client::{OpenSearchClient, SearchPage};
pub use exec::OpenSearchExec;
pub use schema::schema_from_mapping;
pub use table::{
OpenSearchTableFactory, OpenSearchTableProvider, OpenSearchTableProviderFactory, DEFAULT_PAGE_SIZE, FILE_TYPE,
};
#[cfg(feature = "udf")]
pub use udf::{
os_geo_bbox_udf, os_geo_distance_udf, os_geo_polygon_udf, os_match_udf, OS_GEO_BBOX, OS_GEO_DISTANCE,
OS_GEO_POLYGON, OS_MATCH,
};
use datafusion::error::DataFusionError;
use snafu::Snafu;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
#[snafu(display("request to {url} failed: {source}"))]
Http { url: String, source: reqwest::Error },
#[snafu(display("OpenSearch returned {status} for {url}: {body}"))]
Status { status: u16, url: String, body: String },
#[snafu(display("index '{index}' does not exist"))]
IndexNotFound { index: String },
#[snafu(display("could not decode the OpenSearch response from {url}: {source}"))]
Decode { url: String, source: reqwest::Error },
#[snafu(display("the _mapping response for '{index}' has no 'mappings.properties'"))]
MalformedMapping { index: String },
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
impl From<Error> for DataFusionError {
fn from(e: Error) -> Self {
DataFusionError::External(Box::new(e))
}
}