Получаете ElasticsearchStatusException и ElasticsearchResponseException? - PullRequest
2 голосов
/ 01 мая 2020

Что такое ElasticsearchStatusException и ElasticsearchResponseException?

Caused by: org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=request [/user_context/_refresh] contains unrecognized parameter: [ignore_throttled]]

Caused by: org.elasticsearch.client.ResponseException: method [POST], host [http://HOST_NAME:PORT], URI [/user_context/_refresh?ignore_throttled=false&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true], status line [HTTP/1.1 400 Bad Request]

Это то, что я получаю при попытке запустить мой код JavaSpring,

ERROR 26299 --- [           main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : ElasticsearchStatusException[method [HEAD], host [************] ...............

Версия ElasticSearch в pom. xml : 6.8.1 с версией Spring Data Elasticsearch: 3.2.6

Версия удаленного сервера ElasticSearch: 6.2.2

Я использую High Level Rest Client.

 @Override
 @Bean
 public RestHighLevelClient elasticsearchClient() {
 final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
     .connectedTo(elasticsearch_host + ":" + elasticsearch_port).build();
 return RestClients.create(clientConfiguration).rest();
}

Весна Версия: 2.2.4

1 Ответ

0 голосов
/ 01 мая 2020

Похоже, что вы - узелasticsearch пустой, как показано в приведенной ниже ошибке:

AbstractElasticsearchRepository : failed to load elasticsearch nodes : ElasticsearchStatusException[method [HEAD], host []

Если вы используете Elasticsearch локально с портом 9200, вы можете создать клиент высокого уровня Rest. как:

AbstractElasticsearchRepository: не удалось загрузить узлы эластичного поиска: ElasticsearchStatusException [метод [HEAD], хост []

import org.springframework.beans.factory.annotation.Autowired;@Configuration
static class Config {

      @Bean
      RestHighLevelClient client() {

        ClientConfiguration clientConfiguration = ClientConfiguration.builder() 
          .connectedTo("localhost:9200")
          .build();

        return RestClients.create(clientConfiguration).rest();                  
      }
    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...