Better error message for missing index


(Alberto Paro-2) #1

If I try to search in a missing index, ES does return a query message error not very easy to understand.

An exception such as InvalidIndex or MissingIndex should be better.

I'll attach a simple use case (created index myapp_entry and searched myapp_blog) with the return message:

curl -XDELETE http://localhost:9200/test_test -d ''
curl -XPUT http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000001 -d '{"content": "", "date_published": "2010-07-22T06:40:18", "blog_id": null, "id": "4c482e22142bb51d32000001", "title": "entry 1"}'
curl -XPUT http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000002 -d '{"content": "", "date_published": "2010-07-23T06:40:18", "blog_id": null, "id": "4c482e22142bb51d32000002", "title": "entry 2"}'
curl -XPUT http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000003 -d '{"content": "", "date_published": "2010-07-21T06:40:18", "blog_id": null, "id": "4c482e22142bb51d32000003", "title": "entry 3"}'
curl -XPOST http://localhost:9200/test_test/_refresh
curl -XGET 'http://localhost:9200/test_test/myapp_blog/_search' -d '{"query": {"term": {"date_published" : "2010-07-21T06:40:18"}}}'

Error Message:

{"error":"SearchPhaseExecutionException[Failed to execute [query] total failure; shardFailures {[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][0]: QueryPhaseExecutionException[[test_test][0]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed []]; nested: }{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][1]: QueryPhaseExecutionException[[test_test][1]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed []]; nested: }{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][3]: QueryPhaseExecutionException[[test_test][3]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed []]; nested: }{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][4]: QueryPhaseExecutionException[[test_test][4]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed []]; nested: }{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][2]: QueryPhaseExecutionException[[test_test][2]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed []]; nested: }]"}

Stacktrace of es:

[14:55:38,875][DEBUG][action.search.type ] [Heart Attack] [test_test][3], node[b59ce67f-7423-4c34-a966-6bfefc1f2294], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@4d88e490]
org.elasticsearch.search.query.QueryPhaseExecutionException: [test_test][3]: query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]: Query Failed [Failed to execute main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:124)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:169)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:129)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:77)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:194)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:80)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.run(TransportSearchTypeAction.java:153)
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:637)
Caused by: java.lang.NullPointerException
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:81)
... 9 more

Hi,
Alberto


(Shay Banon) #2

Fixed, and based on your example (and the stack trace) I guess you mean
searching on an invalid type, not index.

On Thu, Jul 22, 2010 at 3:57 PM, Alberto Paro alberto.paro@gmail.comwrote:

If I try to search in a missing index, ES does return a query message error
not very easy to understand.

An exception such as InvalidIndex or MissingIndex should be better.

I'll attach a simple use case (created index myapp_entry and searched
myapp_blog) with the return message:

curl -XDELETE http://localhost:9200/test_test -d ''
curl -XPUT
http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000001 -d
'{"content": "", "date_published": "2010-07-22T06:40:18", "blog_id": null,
"id": "4c482e22142bb51d32000001", "title": "entry 1"}'
curl -XPUT
http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000002 -d
'{"content": "", "date_published": "2010-07-23T06:40:18", "blog_id": null,
"id": "4c482e22142bb51d32000002", "title": "entry 2"}'
curl -XPUT
http://localhost:9200/test_test/myapp_entry/4c482e22142bb51d32000003 -d
'{"content": "", "date_published": "2010-07-21T06:40:18", "blog_id": null,
"id": "4c482e22142bb51d32000003", "title": "entry 3"}'
curl -XPOST http://localhost:9200/test_test/_refresh
curl -XGET 'http://localhost:9200/test_test/myapp_blog/_search' -d
'{"query": {"term": {"date_published" : "2010-07-21T06:40:18"}}}'

Error Message:

{"error":"SearchPhaseExecutionException[Failed to execute [query] total
failure; shardFailures
{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][0]:
QueryPhaseExecutionException[[test_test][0]:
query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]:
Query Failed []]; nested:
}{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][1]:
QueryPhaseExecutionException[[test_test][1]:
query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]:
Query Failed []]; nested:
}{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][3]:
QueryPhaseExecutionException[[test_test][3]:
query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]:
Query Failed []]; nested:
}{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][4]:
QueryPhaseExecutionException[[test_test][4]:
query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]:
Query Failed []]; nested:
}{[5183d782-f178-444a-b3d0-a6f31c32be3e][test_test][2]:
QueryPhaseExecutionException[[test_test][2]:
query[date_published:[1279694418000 TO 1279694418000]],from[0],size[10]:
Query Failed []]; nested: }]"}

Stacktrace of es:

[14:55:38,875][DEBUG][action.search.type ] [Heart Attack]
[test_test][3], node[b59ce67f-7423-4c34-a966-6bfefc1f2294], [P], s[STARTED]:
Failed to execute [org.elasticsearch.action.search.SearchRequest@4d88e490]
org.elasticsearch.search.query.QueryPhaseExecutionException:
[test_test][3]: query[date_published:[1279694418000 TO
1279694418000]],from[0],size[10]: Query Failed [Failed to execute main
query]
at
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:124)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:169)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:129)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:77)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:194)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.run(TransportSearchTypeAction.java:153)
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:637)
Caused by: java.lang.NullPointerException
at
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:81)
... 9 more

Hi,
Alberto


(system) #3