Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Created April 1, 2011 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dadoonet/897892 to your computer and use it in GitHub Desktop.
Save dadoonet/897892 to your computer and use it in GitHub Desktop.
Exception when searching docs in ES with Java
package fr.pilato.hibernate.plugins.elasticsearch;
import static org.elasticsearch.index.query.xcontent.QueryBuilders.termQuery;
import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
import static org.junit.Assert.assertEquals;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.junit.Test;
public class ESTestCase {
@Test
public void doMyTest() {
Client client = nodeBuilder().node().client();
SearchResponse response = client.prepareSearch("test")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(termQuery("dossier.domaine.supportsDeclaratifsForES.SupportDeclaratif.reference", "11111"))
.setExplain(true)
.execute()
.actionGet();
assertEquals("We find something with this criteria", 1, response.getHits().getTotalHits());
}
}
curl -XPUT http://localhost:9200/test/dossier/1 -d '{"conformite":"CONFORME", "direction":"DIRECTION", "domaine":{"reglementationsConcernees":["REG"], "supportsDeclaratifsForES":[{"SupportDeclaratif":{"specificite":{"SpecifSDec":{"regime":"1234"}}, "typesVerifications":["DOC"], "controlesPhysiques":[{"ControleMarchandise":{"conclusions":[{"Conclusion":{"reconnu":"1", "typePrecision":"VIDE", "conclusionCtrl":"CONFORME", "declare":"1", "typeAttributMarchandise":"NOMENCLATURE"}}, {"Conclusion":{"reconnu":"586.0", "typePrecision":"VIDE", "conclusionCtrl":"CONFORME", "declare":"586.0", "typeAttributMarchandise":"MASSE_NETTE"}}]}}], "bureauDouane":{"ServiceAdministrationDouane":{"europa":"FR00000", "nom":"Bureau"}}, "conclusion":"null", "infractions":[], "date":"2011-04-01T08:00:00.000+0000", "reference":"11111", "controlesDocumentaires":[{"ControleDocument":{"categorieLibelle":"Libelle", "typePrecision":"null", "categorieCode":"9999", "typeConclusionControle":"CONFORME"}}, {"ControleDocument":{"categorieLibelle":"Facture", "typePrecision":"null", "categorieCode":"8888", "typeConclusionControle":"CONFORME"}}]}}]}, "type":"DOUANE", "sources":[{"type":"CRIT"}], "dateDebut":"2011-04-01T10:00:00.000+0000", "etat":"VALIDE", "agentsRoles":[{"personne":{"Agent":{"nom":"MOI", "personnesIdentifiantsForES":[{"identifiant":"login"}]}}, "typesRoles":["REDACTEUR"]}], "lieuControle":"Bureau", "service":{"ServiceAdministrationDouane":{"europa":"FR00000", "nom":"Bureau"}}, "personnesControlees":[{"personne":{"PersonneMorale":{"nom":"MYCOMP", "personnesIdentifiantsForES":[{"identifiant":"MYEORI"}, {"identifiant":"MYSIRET"}]}}, "role":"DECLARANT"}], "identifiant":"66566767"}'
curl -XGET "http://localhost:9200/test/dossier/_search" -d '{"query":{"term":{"dossier.domaine.supportsDeclaratifsForES.SupportDeclaratif.reference":"11111"}}}'
Failed :
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs], total failure; shardFailures {[1IOMpS32QuSLMWkQkGG4iQ][test][0]: RemoteTransportException[[Lord Dark Wind][inet[/10.115.1.111:9300]][search/phase/dfs]]; nested: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: RuntimeException[Internal error: this code path should never get executed]; }{[1IOMpS32QuSLMWkQkGG4iQ][test][2]: RemoteTransportException[[Lord Dark Wind][inet[/10.115.1.111:9300]][search/phase/dfs]]; nested: SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: RuntimeException[Internal error: this code path should never get executed]; }{[1IOMpS32QuSLMWkQkGG4iQ][test][3]: RemoteTransportException[[Lord Dark Wind][inet[/10.115.1.111:9300]][search/phase/dfs]]; nested: SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: RuntimeException[Internal error: this code path should never get executed]; }{[1IOMpS32QuSLMWkQkGG4iQ][test][1]: RemoteTransportException[[Lord Dark Wind][inet[/10.115.1.111:9300]][search/phase/dfs]]; nested: SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: RuntimeException[Internal error: this code path should never get executed]; }{[1IOMpS32QuSLMWkQkGG4iQ][test][4]: RemoteTransportException[[Lord Dark Wind][inet[/10.115.1.111:9300]][search/phase/dfs]]; nested: SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: RuntimeException[Internal error: this code path should never get executed]; }
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:248)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$400(TransportSearchTypeAction.java:75)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:198)
at org.elasticsearch.search.action.SearchServiceTransportAction$1.handleException(SearchServiceTransportAction.java:119)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:158)
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:149)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:100)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:302)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:214)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment