I expect to use the path field of Suggest Contexts to specify boolean values. When I tried to index my data I get these errors.
{
'index': {
'_index': 'dev-test-data',
'_type': 'doc',
'_id': '1',
'status': 400,
'error': {
'type': 'illegal_argument_exception',
'reason': 'Failed to parse context field [deleted], only keyword and text fields are accepted'
}
}
}
I expect to be able to use a boolean value just like if I provided it in the context dictionary.
From a quick code search it seems there is separate functions which parse the different ways of specifying the paths.
There was a fix last year, https://github.com/elastic/elasticsearch/pull/23491, but I guess it wasn't applied to both code paths.
Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.
PUT dev-test-data
{
"mappings": {
"doc": {
"properties": {
"is_deleted": {
"type": "boolean"
},
"name": {
"type": "text"
},
"name_suggestor": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50,
"contexts": [
{
"name": "deleted",
"type": "CATEGORY",
"path": "is_deleted"
}
]
},
"owner_id": {
"type": "keyword"
}
}
}
}
}
PUT dev-test-data/doc/1
{
"is_deleted": false,
"name": "meow",
"name_suggestor": {
"input": ["meow"],
"weight": 1
}
}
Docker Container: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
Elasticsearch version: 6.2.4
Plugins installed: [N/A]
JVM version: openjdk version "1.8.0_161"
OS version : Linux 2aba93fed05c 4.9.87-linuxkit-aufs #1 SMP Fri Mar 16 18:16:33 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Pinging @elastic/es-search-aggs
@vinayan3 thanks for opening this issue. After looking at #23491 it looks like this was missed in that fix indeed.
Hi,
It seems that this bug is still present in 6.4.2
Can you confirm that it hasn't been fixed ?
Thanks,
@nicolas-t no, it hasn't been fixed yet.
Is there a timeframe as to when this bug will be fixed?
Is this issue still open in 7.5?
Someone found a workaround for this issue?
Hello @jgomes94 I just tried with 7.5, and yes the error is still present.
Haven't found a workaround other than not upgrading.
@jgomes94 @nicolas-t
I found a workaround for this issue:
use fields
to add a string representation of the boolean to the document, and then use the new field in the suggester
Most helpful comment
@jgomes94 @nicolas-t
I found a workaround for this issue:
use
fields
to add a string representation of the boolean to the document, and then use the new field in the suggester