Fixed Error on "find older messages" page after elasticsearch 2.0

estranged

Well-known member
Hi,

After upgrading to elasticsearch 2.0 I have started seeing the error below in the logs. Users get the "search could not be completed" error message when they click "Find older messages" in a members profile page.

Thanks.

Code:
XenForo_Exception: Elasticsearch error: {"root_cause":[{"type":"query_parsing_exception","reason":"No query registered for [numeric_range]","index":"x","line":1,"col":131}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"x","node":"2ZWzqYnLSY6kc3z32WqbDQ","reason":{"type":"query_parsing_exception","reason":"No query registered for [numeric_range]","index":"x","line":1,"col":131}}]} - library/XenES/Search/SourceHandler/ElasticSearch.php:872
Oluşturan: x, 2 dakika önce
Stack Trace
#0 /home/x/public_html/library/XenES/Search/SourceHandler/ElasticSearch.php(557): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true)
#1 /home/x/public_html/library/XenForo/Search/Searcher.php(136): XenES_Search_SourceHandler_ElasticSearch->executeSearchByUserId(102719, 143910497, '500')
#2 /home/x/public_html/library/XenForo/ControllerPublic/Search.php(360): XenForo_Search_Searcher->searchUser(102719, 143910497)
#3 /home/x/public_html/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Search->actionMember()
#4 /home/x/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /home/x/public_html/index.php(13): XenForo_FrontController->run()
#6 {main}
Request State
array(3) {
  ["url"] => string(64) "http://x.com/search/member?user_id=102719&before=143910497"
  ["_GET"] => array(2) {
    ["user_id"] => string(6) "102719"
    ["before"] => string(9) "143910497"
  }
  ["_POST"] => array(0) {
  }
}
 
Have you applied the patch? When? When was this error logged? If the patch has been applied, does this error continue to happen?
 
Confirmed on my forum
Code:
XenForo_Exception: Elasticsearch error: {"root_cause":[{"type":"query_parsing_exception","reason":"No query registered for [numeric_range]","index":"mattwser_xenforo","line":1,"col":126}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"mattwser_xenforo","node":"6Z1kFrDuTHijufVVKOaW-A","reason":{"type":"query_parsing_exception","reason":"No query registered for [numeric_range]","index":"mattwser_xenforo","line":1,"col":126}}]} - library/XenES/Search/SourceHandler/ElasticSearch.php:872
Generated By: Matt, A moment ago
Stack Trace
#0 /home/nginx/domains/mattwservices.co.uk/public/library/XenES/Search/SourceHandler/ElasticSearch.php(557): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true)
#1 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/Search/Searcher.php(136): XenES_Search_SourceHandler_ElasticSearch->executeSearchByUserId(1, 1445714844, '200')
#2 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/ControllerPublic/Search.php(360): XenForo_Search_Searcher->searchUser(1, 1445714844)
#3 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Search->actionMember()
#4 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /home/nginx/domains/mattwservices.co.uk/public/index.php(13): XenForo_FrontController->run()
#6 {main}
Request State
array(3) {
  ["url"] => string(69) "https://mattwservices.co.uk/search/member?user_id=1&before=1445714844"
  ["_GET"] => array(3) {
    ["/search/member"] => string(0) ""
    ["user_id"] => string(1) "1"
    ["before"] => string(10) "1445714844"
  }
  ["_POST"] => array(0) {
  }
}
 
Try opening /library/XenEs/Search/SourceHandler/ElasticSearch.php find:
PHP:
array('numeric_range' => array('date' => array('lt' => $maxDate)))

Change to:
PHP:
array('range' => array('date' => array('lt' => $maxDate)))

It seems like they got rid of all their *_range filters and replaced it with one global range filter.

I haven't tested this as I don't have a board with ElasticSearch installed yet.

[Edit] Now that it is confirmed to be working, I looked again and it appears to be backwards compatible. Should double check before releasing as a patch, of course.
 
Last edited:
Try opening /library/XenEs/Search/SourceHandler/ElasticSearch.php find:
PHP:
array('numeric_range' => array('date' => array('lt' => $maxDate)))

Change to:
PHP:
array('range' => array('date' => array('lt' => $maxDate)))

It seems like they got rid of all their *_range filters and replaced it with one global range filter.

I haven't tested this as I don't have a board with ElasticSearch installed yet.
Yep, that fixes it.
 
Back
Top Bottom