lmenezes / elasticsearch-kopf

web admin interface for elasticsearch
MIT License
2.41k stars 333 forks source link

IndiciesExists always returns True if JestClient is created with Basic authentication #360

Closed agastya71 closed 8 years ago

agastya71 commented 8 years ago

Hi: I ran into this problem wherein I was trying to verify if an index exists, by doing so :

        JestClientFactory factory = new JestClientFactory();
        factory.setHttpClientConfig(new HttpClientConfig.Builder("http://secure.server.es.instance") 
                                    .defaultCredentials("user-name","pass-word")

                                            .multiThreaded(true)
                                            .build());
        JestClient restClient = factory.getObject();

        JestResult jr = restClient.execute(new IndicesExists.Builder("qed").build());
        boolean x = jr.isSucceeded();

the boolean result value x was true. However, I knew from looking at the es instance that the index "qed" did not exist. I started to investigate and found out that if I create the JestClient without basic authentication and access an ES instance without any security enabled, It returned true/false depending on if an index exists or not. If I enabled basic authentication and access an ES instance with security enabled, It always returns true I also saw this error pop up when trying to use the Cat API:

Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 16 column 12 path $

I am running ES 2.1.1 with Jest 2.0.0

up-town-down commented 8 years ago

You probably want to post that in https://github.com/elastic/elasticsearch

lmenezes commented 8 years ago

@up-town-down thanks for replying :)