How can I split string in Elasticsearch

I'm using nodejs as the client-side for Elasticsearch and got the following settings for the query. I want to split the text while users input text like "aa123 bb234" into "aa123 bb" "234". Only split the pattern like "bb234"(maybe b-z, except a ). How can I do that in elasticsearch settings?

      settings: {
        analysis: {
          analyzer: {
            default: {
              type: 'custom',
              tokenizer: 'standard',
              filter: [
                'lowercase',
                'my_shingle'
              ]
            }
          },
          filter: {
            my_shingle: {
              type: "shingle",
              token_separator: ""
            }
          }
        }
      }

I think this what is happening by default with the default analyzer. Did you check what produces the analyze API?

in my use case is:
input ="aa123 bb234"
I want to split bb234 into bb space 234 only, instead of aa123, maybe regex? when the input is [b-z]plus[0-9]?

Could you explain the use case?

Is it a problem with search? Or at index time you want to modify the source document to split content in multiple fields?

It would be easier to provide a recreation script with your source data and a typical search the user would enter.

Just 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.

Please provide a full script we can use to reproduce locally.

Again see the example in About the Elasticsearch category. Please, try to keep the example as simple as possible. We basically need only one field here.

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.

Can I copy and paste it and click on run?

It will give me that lot index does not exist.
So I can not reproduce and help.

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