Validating a query

Hi, I'm trying to validate a query in Java. For example, I want to know
when a user types in "test OR" before i send the query to the cluster. I
tried using ValidateQueryRequest but the validate() method simply does a
return null. Can someone please help me figure this out?

thanks.

--

For ValidateQuery request to work, it has to send the query to the server:

client.admin().indices().prepareValidateQuery("test").setQuery(QueryBuilders.queryString("test
OR")).execute().actionGet().valid()

So, it makes sense only when you don't really need any data back and care
only about validity of the query. For example, you can use this method
before storing saved searches. If you are planning to execute this
query immediately after the validation, it's faster to just send the query
with search request right away and handle possible error response.

On Wednesday, November 28, 2012 7:04:39 PM UTC-5, iamdlu wrote:

Hi, I'm trying to validate a query in Java. For example, I want to know
when a user types in "test OR" before i send the query to the cluster. I
tried using ValidateQueryRequest but the validate() method simply does a
return null. Can someone please help me figure this out?

thanks.

--