Searching word with special characters

Hi! I am having a little problem, I wanted to search a word on elasticsearch but the result that I am expecting is not coming up because it has a tailing special character.

Here’s an example:

The result that I want to show is “fun in park;”

You will notice that there is a semicolon so when I search for the word “park” it is not working. I want it to be on top of the result too. How can I achieve searching for a word and ignoring the special character on the record of the document?

Any help would be appreciated!

I think that the standard analyzer works well in that case.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Hi @dadoonet,

I am trying to have a multiple tokenizer, because I think the "whitespace" tokenizer is causing the problem.

here's my analyzer:

body: {
        settings: {
          analysis: {
            analyzer: {
              my_analyzer: {
                tokenizer: "whitespace",
                filter: ["lowercase", "kstem"],
              },
            },
          },
        },
      }

I am also using whitespace for different features of my app, because I also have to analyze each word.

Is there a way to achieve both whitespace and special character tokenizer?

Why not using the standard tokenizer?

I also need to analyze each words because there are search phrases that is not a real word or in a dictionary and I have to figure out what that word is on the document data. that's why I am breaking the search phrase using whitespace

May be sharing an example would help.

But anyway, I believe you need to apply 2 different analyzers.
Using sub fields would help I guess.

1 Like

Ok I know what to do now. I figured it out! thank you so much :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.