Skip to content

Instantly share code, notes, and snippets.

@kbachl
Created March 8, 2011 09:38
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 kbachl/933bc88c63d30e9f2754 to your computer and use it in GitHub Desktop.
Save kbachl/933bc88c63d30e9f2754 to your computer and use it in GitHub Desktop.
Our books:
Parse Failure [Failed to parse source [_na_]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:416)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:331)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:165)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:132)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:76)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:75)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:168)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
*_0_*
$ curl -XPUT 'http://localhost:9200/books/book -d '{
"name" : "a"
"linie" : ["_0_Religion", "_1_Religion_Jews", "_0_Historic", "_1_Historic_Old"]
"no_delivery": "pakistan"
}'
$ curl -XPUT 'http://localhost:9200/books/book -d '{
"name" : "b"
"linie" : ["_0_Religion", "_1_Religion_Jews", "_0_Historic", "_1_Historic_Old"]
"no_delivery": null
}'
$ curl -XPUT 'http://localhost:9200/books/book -d '{
"name" : "c"
"linie" : ["_0_Religion", "_1_Religion_Christian", "_0_Historic", "_1_Historic_New"]
"no_delivery": "pakistan"
}'
SearchRequestBuilder builder = client.prepareSearch("books");
XContentQueryBuilder qb = QueryBuilders.queryString("*")
.defaultOperator(QueryStringQueryBuilder.Operator.OR)
.field("name")
.field("linie")
.field("no_delivery")
.allowLeadingWildcard(true).useDisMax(true);
builder.setQuery(qb);
builder.addFacet(
FacetBuilders.termsFacet("linie").field("linie").regex("_0_*")
);
SearchRequestBuilder builder = client.prepareSearch("books");
XContentQueryBuilder qb = QueryBuilders.queryString("*")
.defaultOperator(QueryStringQueryBuilder.Operator.OR)
.field("name")
.field("linie")
.field("no_delivery")
.allowLeadingWildcard(true).useDisMax(true);
builder.setQuery(qb);
builder.addFacet(
FacetBuilders.termsFacet("linie").field("linie").facetFilter(new TermsFilterBuilder("linie", "_0_*")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment