Kiedy próbuję indeksować dane, a następnie wykonać zapytanie, wszystko jest w porządku, ale jeśli uruchomię aplikację i wykonam zapytanie bez indeksowania, zanim dostać ten błądFunkcja elasticsearch kończy się niepowodzeniem z błędem "Nie powiodło się wykonanie fazy [query_fetch], wszystkie fragmenty nie powiodły się"
Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query_fetch], all shards failed at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:272)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:307)
at org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:203)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:186)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Oto mój kod i ustawienia elasticsearch
// settings
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("client.transport.sniff", false);
settings.put("path.home", "/path/to/elastic/home");
settings.put("index.number_of_replicas", 0);
settings.put("index.number_of_shards", 1);
settings.put("action.write_consistency", "one");
settings.build();
// creating of node and client
NodeBuilder nb = new NodeBuilder().settings(settings).local(true).data(true);
Node node = nb.node();
Client client = node.client();
/*
for (int i = 0; i <= 15; i++) {
IndexResponse response = client.prepareIndex("twitter2", "tweet2", String.valueOf(i))
.setSource(json1)
.execute()
.actionGet();
}
*/
searchRequestBuilder = client.prepareSearch("twitter2")
.setTypes("tweet2")
.setQuery(QueryBuilders.matchQuery("user", "user0"))
.setQuery(QueryBuilders.matchQuery("message","message1"))
.setExplain(true)
.setSearchType(SearchType.DFS_QUERY_AND_FETCH).setSize(200);
SearchResponse searchRespons = searchRequestBuilder.execute().actionGet(); // here is error
Co jest nie tak w ustawieniach mnie?
Nie możesz wyszukać indeksu/typu, który nie istnieje, prawda? Komentując indeksowanie twitter2/tweet2 po prostu nie masz nic do wyszukiwania. – mconlin
ale widziałem w ścieżce/ścieżce/do/elastycznych/folderów domowych, które zawiera indeksy, które utworzyłem przed i ponieważ przypuszczam, że to możliwe – user3569530
musisz ustawić path.data tak, aby dane były trwałe w tym samym miejscu pomiędzy działa? – mconlin