Registering an analyzer using the example method returns an error when creating the index:
opensearchpy.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'Failed to parse mapping [_doc]: analyzer [whitespace_analyzer] has not been configured in mappings')
It looks like when it goes through the following function:
class Index(object):
def analyzer(self, *args, **kwargs):
analyzer = analysis.analyzer(*args, **kwargs)
d = analyzer.get_analysis_definition()
# empty custom analyzer, probably already defined out of our control
if not d:
return
# merge the definition
merge(self._analysis, d, True)
d is always an empty dict taken from BuiltinAnalyzer.get_analysis_definition - resulting in the definition not being merged.
Am I missing a step, or is this a bug?
How can one reproduce the bug?
standards_index = Index("standards")
@standards_index.document
class StandardDocument(Document):
id = Keyword(required=True)
name = Text(
required=True,
analyzer=ngram_analyzer,
search_analyzer=whitespace_analyzer,
fields={"raw": Keyword()},
)
# ...
whitespace_analyzer = analyzer(
"whitespace_analyzer",
tokenizer="whitespace",
filter=["lowercase", "asciifolding"],
)
# ...
index.analyzer(whitespace_analyzer)
index.create(using=connection) # this line triggers the exception
What is the expected behavior?
The Analyzer is registered correctly and the index can be created with StandardDocument and not trigger an exception.
What is the bug?
Registering an analyzer using the example method returns an error when creating the index:
It looks like when it goes through the following function:
d
is always an emptydict
taken fromBuiltinAnalyzer.get_analysis_definition
- resulting in the definition not being merged.Am I missing a step, or is this a bug?
How can one reproduce the bug?
What is the expected behavior?
The Analyzer is registered correctly and the index can be created with
StandardDocument
and not trigger an exception.What is your host/environment?
WSL2 Ubuntu 18.04.5 LTS
Do you have any screenshots?
N/A
Do you have any additional context?
N/A