Elasticsearch seems broken

I just finished installing and configuring elasticsearch and it’s “working”… however we’ve noticed there is a problem when searching for email addresses.

specifically when searching for domain names.

Example:

If I search for “customername@theirdomain.com”, I get back the specific contact with that email address. However, if I search for “theirdomain.com” I get results for everyone with that domain name in their email. Likewise, if I search for “anothername@long.sub.domain.com” I also get the relevant contact… HOWEVER, if I search for “long.sub.domain.com” I get zero results.

This is the same when searching from cli using:
sudo -u www-data vendor/bin/robo elastic:search "anothername@long.sub.domain.com"
and
sudo -u www-data vendor/bin/robo elastic:search "long.sub.domain.com"

I’m running the following:
SuiteCRM v7.14.6
Elasticsearch v8.18.2
PHP v7.4.33
Apache2 v2.4.62
Mariadb v15.1

Looks like, it is elastic search side issue. Is there any settings that you change change? Maybe input string length.

You can search on the internet, I think you will find some solutions.

That’s a negative… the problem is definitly with suitecrm.

when I run a search on elasticsearch using the following command:

curl -u elastic:PASSWORD -X GET "http://localhost:9200/contacts/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "wildcard": {
      "email.keyword": "*long.sub.domain.com*"
    }
  }
}'

I get the expected results which I do NOT see in suitecrm.

Correction… when I add “*” at the beginning of my search string in suitecrm, now it works as expected… why would that make a diference? when I search for “domain.com”, I get the results I expected to get for “long.sub.domain.com” and more. only when I search for “*long.sub.domain.com” do I get the expected results.

meh… solved.

You can search on the GitHub.

We have few issues and PRs on it related to elasticsearch

Great news! yes, in the suitecrm - you need to use * as a wildcard symbol. :upside_down_face: