ElasticQueryBuilder is a query builder designed to easily build ElasticSearch related DSLs.
```toml
[dependencies] elastic-query-builder ="0.1" ```
``` let mut mapping = MappingBuilder::new(); mapping .addproperty("title",KeywordFieldType::new()) .addproperty("content",TextFieldType::new()); asserteq!!( mapping.build().tostring(), r#"{"mappings":{"properties":{"content":{"type":"text"},"title":{"type":"keyword"}}}}"# );
```
use elastic_query_builder::query::bool_query::BoolQuery;
use elastic_query_builder::query::match_query::MatchQuery;
use elastic_query_builder::QueryBuilder;
use serde_json::{Value};
let mut query = QueryBuilder::new();
let mut bool = BoolQuery::new();
bool.add_must(MatchQuery::new("field","value"));
bool.add_must(MatchQuery::new("field2","value2"));
query.set_query(bool);
let value:Value = query.build();