ElasticSearch 6.x does not support multiple type mappings in a single index. So I have for example 2 indices:
- location
- postcode
I want to have autocomplete functionality (I use completion suggester) using both indices. Is it possible?
This is my example of mapping location index:
{
"location": {
"mappings": {
"location": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": false,
"preserve_position_increments": false,
"max_input_length": 50
}
}
}
}
}
}
And postcode index:
{
"postcode": {
"mappings": {
"postcode": {
"properties": {
"code": {
"type": "text"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
}
}
}
}
It's possible to do a request if I just skip index name in a request, e.g.
POST _search
{
"suggest": {
"suggestion": {
"prefix": "abc",
"completion": {
"field": "suggest"
}
}
}
}
It searches in both indices but the result is incorrect. For example in the previous request we're searching for values start with abc
. If location index contains many documents with values start with abc
, e.g. abcd
or abcde
, then the response won't contain values from postcode index even if it contains exact value abc
.
As I understand the problem is that Completion Suggester works only per index. FST is built per index. So in my case a have 2 graphs. I'm looking for apportunity to combine these graphs.