0

I'm facing an issue on the elastic search that it's not able to search if someone types wrong spelling. I have done some R & D about Soundex. Now I'm facing an issue to implement Soundex on elastic search. Please help me to do that, I've already installed Phonetic Anaalysis plugin on elastic search but how to configure the plugin with elastic search that will work with the search results.

'title' => [
                    'type' => 'text',
                    'analyzer' => $language . '_analyzer',
                    'index' => true,
                    'norms' => false,
                    'term_vector' => 'with_positions_offsets',
                    'fields' => [
                        'raw' => [
                            'type' => 'keyword',
                            'normalizer' => 'lowercase_normalizer',
                            'index' => true,
                            'norms' => false,
                        ],
                    ],
                ],
Niladri
  • 169
  • 1
  • 5

1 Answers1

0

You need to create a custom analyzer using phonetic token filter and the apply this custom analyzer to your text field.

Alternatively, if you want to search with mistypes you can use fuzzy matches.

ilvar
  • 5,718
  • 1
  • 20
  • 17
  • I've already done R & D on that but am unable to understand where I need to add that analyzer in the index or somewhere else. – Niladri Dec 16 '21 at 11:06
  • Yes analyzer settings are index specific, you should [set it up](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html) when creating the index (or in the index template if you use them). – ilvar Dec 16 '21 at 14:03
  • I've updated a code block where the existing configuration has. Can you please help me how can I add custom analyzer here – Niladri Dec 20 '21 at 14:43
  • Yes you should set up analyzer when you create the index. There are some snippets at the link above. – ilvar Dec 20 '21 at 20:55
  • Thanks, @ilvar. THe problem is solved now. Thanks again. – Niladri Feb 23 '22 at 13:36