Question

I am using

SearchBuilder.searchSource.query(query_string).buildAsBytes() 

to perform the query string on elasticsearch servers.

The problem is that I dont know what is the correct format of query string. For instance, I want to find all documents with country field to be US, I can use the restful api of

http://my.elastic.search.server/foo/dummy/_search?q=country:US

to get what I need. But in terms of java api, I tried country:US, q=country:US, and {\"country\":\"US\"}, but each time I got back SearchPhaseExecutionException.

ElasticSearch's documentation does not shed any lights on what could be the format of query string in this case, and I have exhausted Google results related to this topic. Can someone help me on this? Thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top