cosmocode / dokuwiki-plugin-elasticsearch

Integrate an external Elasticsearch engine into DokuWiki
https://www.dokuwiki.org/plugin:elasticsearch
4 stars 6 forks source link

Using analyzer other than [standard] #17

Open sctEdwin opened 2 years ago

sctEdwin commented 2 years ago

Hi there, I am using another analyzer other than [standard] so I created an index with default analyzer set as [kuromoji"], the language settings of my dokuwiki is in Japanese so "kuromoji" will work well with Japanese tokenizer. About kuromoji https://www.atilika.org/

When I try to indexing the created index using the plugin command "./plugin.php elasticsearch index", the error says I cannot update parameter [analyzer] from [kuromoji] to [standard]. I do not want to use [standard] analyzer or text field, is there anyway that I can create an index for dokuwiki without auto generating the mapping of analyzer to [standard] for text fields?

first_create_index_with_analyzer_kuromoji

kuromoji_index

specify_created_index_as_dokuwiki_index

index_generate_error_occur

Here is the original dokuwiki index used, I would like to have analyzer "kuromoji" for text fields instead.

want_kuromoji_instead

Would appreciate any feedback.

splitbrain commented 2 years ago

It should be possible to use the CLI to create the mapping using the standard indexer, then modify the index via elastic's interface/api and then index the wiki?

sctEdwin commented 2 years ago

@splitbrain

Thank you for your reply. Could you elaborate a bit on how to do so?

Do you mean I should perform the following?(Not sure about order of step 3 and 4)

  1. Specify on Dokuwiki the index name to be generate

  2. Use CLI command "./bin/plugin.php elasticsearch createindex" to generate the index

  3. Use CLI command "./plugin.php elasticsearch createlangmapping" to create language mapping first

  4. Use Update index API to add analyzer [kuromoji] to analysis field. https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html#update-settings-analysis https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-kuromoji-analyzer.html

  5. Use CLI command "./bin/plugin.php elasticsearch index" to autoindex

splitbrain commented 2 years ago

Yeah. Something like that.