After upgrade elasticsearch version getting error no [query] registered for [filter]","line":1,"col":20}],"type":"parsing_exception","reason":"no [query] registered for [filter]","line":1,"col":20},"status":400}

Elasticsearch version (bin/elasticsearch --version): 5.0

Plugins installed: [] NO

JVM version (java -version):

OS version (uname -a if on a Unix-like system): Linux

Description of the problem including expected versus actual behavior:
I upgrade elastic search 5.0 version and I using below query

'body' => [
'query' => [
'filtered' => [
'filter' => [
'bool' => [
'must' => [
'multi_match' => [
'query' => $search,
'fields' => [
'product_description',
'link_page_content',
'faq_group',
'forum_title',
'faq_question',
'faq_answer',
'forum_contents',
'keyword_content'
],
'operator' => 'and',
'minimum_should_match' => '100%',
'boost' => 10
]
]
]
]
]
]
and I using below settings

'settings' => [
'analysis' => [
'filter' => [
'nGram_filter' => [
'type' => 'nGram',
'min_gram' => 1,
'max_gram' => 20,
'token_chars' => [
'letter',
'digit',
'punctuation',
'symbol'
]
],
'custom_english_stemmer' => [
'type' => 'stemmer',
'name' => 'english'
]
],
'analyzer' => [
'nGram_analyzer' => [
'type' => 'custom',
'tokenizer' => 'whitespace',
'filter' => [
'lowercase',
'custom_english_stemmer',
'asciifolding',
'nGram_filter'
]
],
'whitespace_analyzer' => [
'type' => 'custom',
'tokenizer' => 'whitespace',
'filter' => [
'lowercase',
'custom_english_stemmer',
'asciifolding'
]
],
'analyzer_startswith' => [
'tokenizer' => 'keyword',
'filter' => 'lowercase'
]
]
]
],
'mappings' => [
'dvm_content_search' => [
'properties' => [
'link_text' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_href' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_page_content' => [
'type' => 'string',
'index' => 'analyzed',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
]
]
],
'dvm_faq_search' => [
'properties' => [
'link_text' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_href' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'question_no' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'faq_group' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
],
'faq_question' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
],
'faq_answer' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
]
]
],
'dvm_forum_search' => [
'properties' => [
'link_text' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_href' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'forum_id' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'forum_parent_id' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'forum_title' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
],
'forum_contents' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
]
]
],
'dvm_product_search' => [
'properties' => [
'link_text' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_href' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'product_id' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'product_name' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'product_description' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
]
]
],
'dvm_keyword_search' => [
'properties' => [
'link_text' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'link_href' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'keyword_content' => [
'type' => 'text',
'index' => 'true',
'analyzer' => 'nGram_analyzer',
'search_analyzer' => 'whitespace_analyzer',
'term_vector' => 'with_positions_offsets'
],
'keyword_discription' => [
'type' => 'string',
'index' => 'not_analyzed'
],
'keyword_conditions' => [
'type' => 'string',
'index' => 'not_analyzed'
]
]
]
]

I am getting below error

Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [filter]","line":1,"col":20}],"type":"parsing_exception","reason":"no [query] registered for [filter]","line":1,"col":20},"status":400}' in /var/www/html/releases/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:610 Stack trace: #0 /var/www/html/releases/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(273): Elasticsearch\Connections\Connection->process4xxError(Array, Array, Array) #1 /var/www/html/releases/vendor/react/promise/src/FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array) #2 /var/www/html/releases/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php(55): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL) #3 /var/www/html/releases/vendor/guzzlehttp/ringphp/src/Core.php(341): GuzzleHttp\ in /var/www/html/releases/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 610

As I said on GitHub the filtered query does not exist anymore.
Search in the breaking changes and replace that with a bool query

1 Like

Can you please give any example OR reference hoy I replace filtered with bool query.

It’d be faster to use the search button in elasticsearch reference guide but here we go:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

1 Like

I have changed below in query

'query' => [
'bool' => [
'filter' => [
'must' => [
'multi_match' => [
'query' => $search,
'fields' => [
'product_description',
'link_page_content',
'faq_group',
'forum_title',
'faq_question',
'faq_answer',
'forum_contents',
'keyword_content'
],
'operator' => 'and',
'minimum_should_match' => '100%',
'boost' => 10
]
]
]
]
]

But I getting same error. Please give your help/suggestion for the same.

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

I don't read PHP code. How this translates to a JSON document? Could you share the JSONified version of it?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.