allo-media/elm-es-simple-query-string/2.0.0

NOTE: the latest version is 4.0.0

Elastic

Parse and serialize ElasticSearch search query strings.

This package allows to parse an elastic simple query string into an AST.

Notes:

  • ~N operator is not supported.

Demo

Parser

parseQuery : String -> Result (List DeadEnd) Expr

Parse an ElasticSearch search query string and convert it into an AST.

Serializer

serializeExpr : { explicitOr : Bool } -> Expr -> String

Serialize an AST into an ElasticSearch search query string.

Options:

  • explicitOr: wraps groups with parenthesis to explicit operator precedence. This is useful for ambiguous queries like foo bar | foo baz which should better be treated as (foo bar) | (foo baz).