0

How to configure a custom analyzer for elasticSearch in springboot? I have a problem of splitting email address while searching. for example: if email address is “alice@domain.com”, it will be splitted into “alice” and “domain.com”. I dont need this. I found, it can be fixed by creating a custom analyzer with tokenizer "uax_url_email". but I can't configure it in springboot. I will show you, how I configured and please help me to fix it.

configuration: settings/settings.json :

{
      "settings": {
        "analysis": {
          "analyzer": {
            "my_email_analyzer": {
              "type": "custom",
              "tokenizer": "uax_url_email",
              "filter": ["lowercase", "stop"]
            }
          }
        }
      }
}

settings/mappings.json:

{
      "mappings": {
        "message": {
          "properties": {
            "content": {
              "type": "string",
              "analyzer": "my_email_analyzer"
            }
          }
        }
      }
    }  

organization class :

@Document(indexName = "organization", type="organization")
@Setting(settingPath = "/settings/settings.json")
@Mapping(mappingPath = "/settings/mappings.json")
public class Organization{   

    @Id
    private long id;
    private String mail;

    /** other fields, getters and setters are omitted **/

}
Arun Girivasan
  • 532
  • 1
  • 10
  • 24

0 Answers0