I tried to send http/get to my elasticsearch server.if I query:
        
        curl 'http://localhost:9200/index/_search?scroll=1m&size=50&pretty' 
-d '{"query" : {"match_all" : {}}}'

it works perfect. But when I tried to use jersy to build my client, I did 
the follwoing:
    
        public class JerseyClientGet {
 
             public static void main(String[] args) {
       
                 Client client = Client.create();
                 WebResource webResource = client
   .resource("http://localhost:9200/index/_search?scroll=1m&size=50 -d 
'{\"query\" : {\"match_all\" : {}}}'");
               ......
             }
        }

And I got these error message:

         java.lang.IllegalArgumentException: Illegal character in query at 
index 52: http://localhost:9200/obd2/_search?scroll=1m&size=50 -d '{"query" 
: {"match_all" : {}}}'
     at java.net.URI.create(URI.java:859)
     at com.sun.jersey.api.client.Client.resource(Client.java:433)
     at JerseyClientGet.main(JerseyClientGet.java:20)
         Caused by: java.net.URISyntaxException: Illegal character in query 
at index 52: http://localhost:9200/index/_search?scroll=1m&size=50 -d 
'{"query" : {"match_all" : {}}}'
     at java.net.URI$Parser.fail(URI.java:2829)
     at java.net.URI$Parser.checkChars(URI.java:3002)
     at java.net.URI$Parser.parseHierarchical(URI.java:3092)
     at java.net.URI$Parser.parse(URI.java:3034)
     at java.net.URI.<init>(URI.java:595)
     at java.net.URI.create(URI.java:857)
     ... 2 more

The "-d" seems to be an illegal character?
Anyone knows what's the problem with my format?
PS: I can use java API to query, just use this RESTful for some test.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c7495d9d-bace-4c09-9f58-6b49c4888cc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to