Defining analyzer while querying in elasticSearch
===

I am pretty new to elastic search.Just need some clarification:
Can we define a analyzer while querying the search server. I tried it with the "text" and "field" query and it works fine:

    > Query:
    > 
    
        > curl -XPOST http://localhost:9200/test/user/_search? -d '{ "query" : {
        > "text" : {"_all" : {"query" :"Vaibhav","analyzer" :
        > "lowercase_keyword" }} } }'

   

>  Result:
>     {"took":144,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.10848885,"hits":[{"_index":"test","_type":"user","_id":"1","_score":0.10848885,
> "_source" : {
>     "first_name": "Vaibhav",
>     "last_name":"saini",
>     "password":"pwd"

But when i try to do the same thing with term/prefix/wildcard query i get the exception:

    > Query: curl -XPOST http://localhost:9200/test/user/_search? -d '{
    > "query" : { "term" : {"_all" : {"query" :"Vaibhav","analyzer" :
    > "lowercase_keyword" }} } }'

   

>  Result:
>     {"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures
> {[kws9J6tbQtWCMNKBm3Gpkw][test][4]: SearchParseException[[test][4]:
> from[-1],size[-1]: Parse Failure [Failed to parse source
> [\n{\n\"query\" : {\n\"term\" : {\"_all\" : {\"query\"
> :\"Vaibhav\",\"analyzer\" : \"lowercase_keyword\" }}\n}\n}]]]; nested:
> QueryParsingException[[test] [term] query does not support [query]];
> }{[kws9J6tbQtWCMNKBm3Gpkw][test][1]: SearchParseException[[test][1]:
> from[-1],size[-1]: Parse Failure [Failed to parse source
> [\n{\n\"query\" : {\n\"term\" : {\"_all\" : {\"query\"
> :\"Vaibhav\",\"analyzer\" : \"lowercase_keyword\" }}\n}\n}]]]; nested:
> QueryParsingException[[test] [term] query does not support [query]];
> }{[kws9J6tbQtWCMNKBm3Gpkw][test][2]: SearchParseException[[test][2]:
> from[-1],size[-1]: Parse Failure [Failed to parse source
> [\n{\n\"query\" : {\n\"term\" : {\"_all\" : {\"query\"
> :\"Vaibhav\",\"analyzer\" : \"lowercase_keyword\" }}\n}\n}]]]; nested:
> QueryParsingException[[test] [term] query does not support [query]];
> }]","status":500}


So is it like we can't define analayzers while querying the elastic search server for some type of queries and for others we can, and if not, am i doing anything wrong.

Any help is greatly appreciated.

