The Query DSL supports Lucene queries via the "query_string" query. See
.
To validate your queries I recommend using the Validate API, as documented
at Elasticsearch Platform — Find real-time answers at scale | Elastic.
On Monday, October 8, 2012 11:30:00 AM UTC-7, Ivan Brusic wrote:
Part of my system accepts strings in the Lucene syntax, which are either
single terms "123" or groups "(123 4 3412)".With Lucene, I can use a QueryParser to parse a query string and it would
return either a TermQuery or a BooleanQuery. In Elasticsearch, the
QueryParser requires a QueryParseContext, which means it probably cannot be
used outside the context of Elasticsearch. Parsing on the client side also
allows me to check for potential errors in the string.My current solution is to use Lucene's QueryParser and convert Lucene
Querys into their Elasticsearch equivalent. Does a better way exist using
straight Elasticsearch? Either a way to create a simple QueryParseContext
or a QueryBuilder that accepts a Lucene Query.Cheers,
Ivan
--