Basic phrase search not working

I have this query:

{
    index: "contact_search",
    compound: {
        must: [
        {equals: {path: "account_id", value: {'$oid': "63e0f08557f2fc26e391ccef"} }}
        ],
        should: [
        {phrase: {
            query: "+34617362325",
            path: "phone",
        }}
        ],
        minimumShouldMatch: 1
    }
}

with this index:

{
  "analyzer": "lucene.simple",
  "searchAnalyzer": "lucene.simple",
  "mappings": {
    "dynamic": true,
    "fields": {
      "account_id": {
        "type": "objectId"
      },
      "additional_emails": {
        "analyzer": "emailAddressAnalyzer",
        "tokenization": "edgeGram",
        "type": "autocomplete"
      },
      "additional_phones": {
        "maxGrams": 10,
        "minGrams": 3,
        "tokenization": "nGram",
        "type": "autocomplete"
      },
      "assignee_id": {
        "type": "objectId"
      },
      "email": [
        {
          "type": "string"
        },
        {
          "analyzer": "emailAddressAnalyzer",
          "tokenization": "edgeGram",
          "type": "autocomplete"
        }
      ],
      "first_name": {
        "maxGrams": 10,
        "minGrams": 3,
        "type": "autocomplete"
      },
      "last_name": {
        "maxGrams": 10,
        "minGrams": 3,
        "type": "autocomplete"
      },
      "phone": [
        {
          "type": "string"
        },
        {
          "maxGrams": 12,
          "minGrams": 3,
          "type": "autocomplete"
        }
      ],
      "second_last_name": {
        "maxGrams": 10,
        "minGrams": 3,
        "type": "autocomplete"
      }
    }
  },
  "analyzers": [
    {
      "name": "emailAddressAnalyzer",
      "tokenizer": {
        "type": "uaxUrlEmail"
      }
    }
  ]
}

And no matter which phone I put, that is always returning 0 results. If I use the same query for email is working perfectly.

Could anyone help me?

I believe “lucene.simple” anlayzer doesn’t create tokens for the numbers or special characters. Try to use the “lucene.standard” analyzer instead.

Example: Search playground

That did the trick! Thank you!

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