Closed nahuelange closed 8 years ago
I am sorry, if you don't post the code that's causing your issues there is nothing I can do. Could you please post the code and a description of what the code/analyzer is supposed to do? Thanks
With no code I cannot tell what's going on. Feel free to reopen the issue if you can replicate it. Thanks!
I may have run into the same issue, although having just started using elasticsearch-dsl
it could be my n00bieness that's the cause! Say I want to create a custom analyzer that uses an autocomplete_filter
of type edgeNGram
, as defined below:
from elasticsearch_dsl.analysis import CustomAnalyzer, EdgeNGramTokenFilter
autocomplete_filter = EdgeNGramTokenFilter(
'autocomplete_filter',
min_gram=1,
max_gram=20
)
autocomplete = CustomAnalyzer(
'autocomplete',
tokenizer='standard',
filter=['lowercase', 'autocomplete_filter']
)
When I try to build the mapping, I get the following exception:
File "/some/local/path/python2.7/site-packages/elasticsearch_dsl/utils.py", line 196, in get_dsl_class
raise UnknownDslObject('DSL class `%s` does not exist in %s.' % (name, cls._type_name))
elasticsearch_dsl.exceptions.UnknownDslObject: DSL class `custom` does not exist in token_filter.
I suspect this is what the OP was also trying to do...
Thanks! This error is definitely misleading and should be fixed. What is going on, however, is that you are not passing in the filter but just it's name. There is then no way for the analyzer (autocomplete) to know where to take the autocomplete_filter
you refer to. Correct way is to pass the token filter itself, not its name.
Ah! Of course. Thanks for the lightning response.
Hi, I have a similar issue. I'm trying to use the following custom analyzer:
html_kuromoji = analyzer('html_kuromoji',
tokenizer='kuromoji_tokenizer',
filter=['kuromoji_baseform','kuromoji_part_of_speech','cjk_width','ja_stop','kuromoji_stemmer', 'lowercase'],
char_filter=['html_strip']
)
but I'm getting the error:
elasticsearch_dsl.exceptions.UnknownDslObject: DSL class
customdoes not exist in token_filter.
Note, these "kuromoji_" things are from the official elasticsearch japanese plugin, which I installed on the server via:
bin/plugin -install elasticsearch/elasticsearch-analysis-kuromoji/2.7.0
I test a simple analyze call using curl and it seems the analyzer is installed.
Am I declaring this custom analyzer wrong?
I am sorry @thavidu, I completely missed your question here. Please see #328 which is exactly the same issue.
Trying to make my own analyzer I got this error : The type is set to custom, but can't be instanciated… because it's missing. I made something wrong?