i trying execute uri based query below. don't see effect of search parameters passing. , want disable _source=false. can me query. using java perform same using java.net packages. query return no matter search parameter pass.
uri: "http://localhost:9200/twitter/twitter/_search?updatedby=xx&node=yy"
java code:
string charset = "utf-8"; string updatedby = "xx"; string node = "yy"; string query = string.format("updatedby:%s&nodeid:%s", urlencoder.encode(updatedby, charset), urlencoder.encode(nodeid, charset)); system.out.println(searchesurl + "?q=" + query); urlconnection connection = new url(searchesurl + "?q=" + query).openconnection(); connection.setrequestproperty("accept-charset", charset);
try instead
string query = string.format("updatedby:%s+and+nodeid:%s", urlencoder.encode(updatedby, charset), urlencoder.encode(nodeid, charset)); urlconnection connection = new url(searchesurl + "?_source=false&q=" + query).openconnection();
the issue whatever sent in q=
parameter needs follow query string query syntax rules , 2 constraints anded using and
operator not &
this: updatedby:xx , nodeid:yy
the uri want construct thus:
"http://localhost:9200/twitter/twitter/_search?q=updatedby:xx , nodeid:yy"
Comments
Post a Comment