Closed
Description
Elasticsearch Version
8.x / 9.x
Installed Plugins
No response
Java Version
bundled
OS Version
any
Problem Description
Using the mapping and analyzers described in the Steps to Reproduce
section returns a 500 status code:
{
"error": {
"root_cause": [
{
"type": "illegal_state_exception",
"reason": "field \"content.joined\" was indexed without position data; cannot run MultiPhraseQuery (phrase=content.joined:\"(hello helloworld) world\")",
"stack_trace": "org.elasticsearch.ElasticsearchException$1: field \"content.joined\" was indexed without position data; cannot run MultiPhraseQuery (phrase=content.joined:\"(hello helloworld) world\")\n\tat [email protected]/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:725)\n\tat [email protected]/org.elasticsearch.action.search.SearchPhaseExecutionException.guessRootCauses(SearchPhaseExecutionException.java:167)\n\tat [email protected]/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:707)\n\tat [email protected]/org.elasticsearch.ElasticsearchException.generateFailureXContent(ElasticsearchException.java:639)\n\tat [email protected]/org.elasticsearch.rest.RestResponse.build(RestResponse.java:202)\n\tat [email protected]/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:161)\n\tat [email protected]/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:122)\n\tat [email protected]/org.elasticsearch.rest.action.RestActionListener.onFailure(RestActionListener.java:54)\n\tat [email protected]/org.elasticsearch.rest.action.RestCancellableNodeClient$1.onFailure(RestCancellableNodeClient.java:97)\n\tat [email protected]/org.elasticsearch.action.ActionListenerImplementations.safeAcceptException(ActionListenerImplementations.java:78)\n
},
"status": 500
}
This is unexpected, as this should be a 400 status code instead.
Removing the bigram analyzer from the mapping below results in a 400 when doing the same query.
Steps to Reproduce
PUT test-multi-match
{
"mappings": {
"properties": {
"content": {
"type": "text",
"fields": {
"joined": {
"type": "text",
"index_options": "freqs",
"search_analyzer": "q_text_bigram"
}
}
}
}
},
"settings": {
"analysis": {
"filter": {
"bigram_joiner_unigrams": {
"max_shingle_size": "2",
"token_separator": "",
"output_unigrams": "true",
"type": "shingle"
}
},
"analyzer": {
"q_text_bigram": {
"filter": [
"bigram_joiner_unigrams"
],
"type": "custom",
"tokenizer": "standard"
}
}
}
}
}
}
PUT test-multi-match/_doc/1
{
"content": "hello world"
}
Returns a 500 status code when executing:
GET test-multi-match/_search?error_trace=true
{
"query": {
"multi_match": {
"query": "hello world",
"type": "phrase",
"fields": ["content.joined"]
}
}
}
Logs (if relevant)
No response