Skip to content

Instantly share code, notes, and snippets.

@Vineeth-Mohan
Created March 6, 2012 09:34
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 Vineeth-Mohan/1985311 to your computer and use it in GitHub Desktop.
Save Vineeth-Mohan/1985311 to your computer and use it in GitHub Desktop.
Commands -
curl -X PUT "localhost:9200/algotree" -d '{ "settings" : { "index" : { "number_of_shards" : 2, "number_of_replicas" : 1 },
"analysis" : {"analyzer":{"my_analyzer" : { "tokenizer" : "keyword", "filter" : ["icu_normalizer"] }}}
}}'
echo
curl -X PUT "localhost:9200/algotree/public/_mapping" -d '{
"public" :{
"properties" :{
"id" : { "type" : "string" } ,
"names" : { "type" : "nested" }
}
}
}'
curl -X POST "localhost:9200/algotree/public" -d '{ "id" : "first", "names" : [ {"id" : "1" , "name" : "there was the god first"},{ "id" : "2" , "name" : "then came the world"}] }'
curl -X POST "localhost:9200/algotree/public" -d '{ "id" : "second", "names" : [ {"id" : "3" , "name" : "this is epic , c team is gone"},{ "id" : "4" , "name" : "the return of the pink flower"}] }'
QUERY request
{
"query": {
"nested": {
"path": "names",
"score_mode": "avg",
"query": {
"bool": {
"must": [
{
"text": {
"names.name": "god"
}
}
]
}
}
}
},
"highlight": {
"fields": {
"names.name": {}
}
}
}
ERROR stack trace
org.elasticsearch.search.query.QueryPhaseExecutionException: [algotree][1]: query[BlockJoinQuery (filtered(names.name:god)->FilterCacheFilterWrapper(_type:__names))],from[0],size[10]: Query Failed [Failed to execute main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:238)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)
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:662)
Caused by: java.lang.NullPointerException
at org.elasticsearch.index.query.NestedQueryParser$LateBindingParentFilter.getDocIdSet(NestedQueryParser.java:170)
at org.elasticsearch.index.search.nested.BlockJoinQuery$BlockJoinWeight.scorer(BlockJoinQuery.java:171)
at org.apache.lucene.search.FilteredQuery.getFilteredScorer(FilteredQuery.java:149)
at org.apache.lucene.search.FilteredQuery$1.scorer(FilteredQuery.java:117)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:577)
at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:199)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)
... 9 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment