convert

Function convert 

Source
pub fn convert(
    query: String,
    from: i32,
    size: i32,
    sort: Vec<&str>,
    aggs: Vec<&str>,
) -> Result<Value, ParseError>
Expand description

convert user input to Elasticsearch DSL example :

extern crate elastic_query;
use elastic_query::convert;
convert("a = 1 and b = 2 and c = 3".to_string(), 0, 1000, vec![], vec![]);

will generate result :

{
   "query": {
   	"bool": {
   		"must": [{
   			"bool": {
   				"must": [{
   					"match": {
   						"a": {
   							"query": "1",
   							"type": "phrase"
   						}
   					}
   				}, {
   					"match": {
   						"b": {
   							"query": "2",
   							"type": "phrase"
   						}
   					}
   				}]
   			}
   		}, {
   			"match": {
   				"c": {
   					"query": "3",
   					"type": "phrase"
   				}
   			}
   		}]
   	}
   }
}