Synonym mappings limit exceeded?

Guys, some idea of what is this?, I have been looking through the documentation without success nor able to find a reference to such limit in the limits documentation.

It happens if I try to add a second mapping to a search index.
The concrete case is that I have 2 fields title and edition that are analyzed differently depending on the language:

title: {
      multi: {
        de: {
          searchAnalyzer: 'lucene.german',
          type: 'string',
        },
        en: {
          searchAnalyzer: 'lucene.english',
          type: 'string',
        },
        es: {
          searchAnalyzer: 'lucene.spanish',
          type: 'string',
        },
        fr: {
          searchAnalyzer: 'lucene.french',
          type: 'string',
        },
        it: {
          searchAnalyzer: 'lucene.italian',
          type: 'string',
        },
        pt: {
          searchAnalyzer: 'lucene.portuguese',
          type: 'string',
        },
      },
      type: 'string',
    },
    edition: {
      multi: {
        de: {
          searchAnalyzer: 'lucene.german',
          type: 'string',
        },
        en: {
          searchAnalyzer: 'lucene.english',
          type: 'string',
        },
        es: {
          searchAnalyzer: 'lucene.spanish',
          type: 'string',
        },
        fr: {
          searchAnalyzer: 'lucene.french',
          type: 'string',
        },
        it: {
          searchAnalyzer: 'lucene.italian',
          type: 'string',
        },
        pt: {
          searchAnalyzer: 'lucene.portuguese',
          type: 'string',
        },
      },
      type: 'string',
    },

And here is how I’m trying to create the mapping:

[
{
  analyzer: 'lucene.english',
  name: 'book-english-synonyms',
  source: {
    collection: 'synonyms',
  },
},
{
  analyzer: 'lucene.spanish',
  name: 'book-spanish-synonyms',
  source: {
    collection: 'synonyms',
  },
},
]

And just to complete the idea I query like:

{ value: 'title', multi: 'en' },
{ value: 'edition', multi: 'en' },

And the problem that I’m trying to resolve is that I want to use a synonym for ‘1st’ to be ‘first’ and viceversa.
Concrete example (and what I’m trying to resolve), If I search for “Optimize B2 first” or “Optimize B2 1st”, I should get the same results. Currently the result with larger score is the one that matches the way “first” is being written.

Thanks in advance

Thanks for providing that index definition and the context for the searches @Ignacio_Larranaga.

I would like to get some further clarification here, is the 2 “query”'s you’ve mentioned in the above quote two separate $search queries? If so, could you provide the following:

  1. Sample documents that match your 2 example search terms ( “Optimize B2 first” or “Optimize B2 1st" )
  2. The $search aggregation pipeline(s) used with reference to the sample documents
  3. The output that demonstrates what you have mentioned regarding the larger score being present (based off the sample documents)

Look forward to hearing your response.

Regards,
Jason

Thanks @Jason_Tran , just to clarify I’m not really having an issue with the query but when creating the mapping. The “Synonym mappings limit exceeded” appears when I try to add a second synonym to the same index.

Specifically here are my current mappings:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "activeCopyCounts": {
        "dynamic": true,
        "type": "document"
      },
      "authors": {
        "type": "string"
      },
      "edition": {
        "multi": {
          "de": {
            "analyzer": "lucene.german",
            "searchAnalyzer": "lucene.german",
            "type": "string"
          },
          "en": {
            "analyzer": "lucene.english",
            "searchAnalyzer": "lucene.english",
            "type": "string"
          },
          "es": {
            "analyzer": "lucene.spanish",
            "searchAnalyzer": "lucene.spanish",
            "type": "string"
          },
          "fr": {
            "analyzer": "lucene.french",
            "searchAnalyzer": "lucene.french",
            "type": "string"
          },
          "it": {
            "analyzer": "lucene.italian",
            "searchAnalyzer": "lucene.italian",
            "type": "string"
          },
          "pt": {
            "analyzer": "lucene.portuguese",
            "searchAnalyzer": "lucene.portuguese",
            "type": "string"
          }
        },
        "type": "string"
      },
      "isbn": {
        "type": "string"
      },
      "labelsDe": {
        "analyzer": "lucene.german",
        "searchAnalyzer": "lucene.german",
        "type": "string"
      },
      "labelsEn": {
        "analyzer": "lucene.english",
        "searchAnalyzer": "lucene.english",
        "type": "string"
      },
      "labelsEs": {
        "analyzer": "lucene.spanish",
        "searchAnalyzer": "lucene.spanish",
        "type": "string"
      },
      "labelsFr": {
        "analyzer": "lucene.french",
        "searchAnalyzer": "lucene.french",
        "type": "string"
      },
      "labelsIt": {
        "analyzer": "lucene.italian",
        "searchAnalyzer": "lucene.italian",
        "type": "string"
      },
      "labelsPt": {
        "analyzer": "lucene.portuguese",
        "searchAnalyzer": "lucene.portuguese",
        "type": "string"
      },
      "prices": {
        "fields": {
          "countryCode": {
            "analyzer": "lucene.keyword",
            "searchAnalyzer": "lucene.keyword",
            "type": "string"
          }
        },
        "type": "document"
      },
      "publisher": {
        "type": "string"
      },
      "title": {
        "multi": {
          "de": {
            "analyzer": "lucene.german",
            "searchAnalyzer": "lucene.german",
            "type": "string"
          },
          "en": {
            "analyzer": "lucene.english",
            "searchAnalyzer": "lucene.english",
            "type": "string"
          },
          "es": {
            "analyzer": "lucene.spanish",
            "searchAnalyzer": "lucene.spanish",
            "type": "string"
          },
          "fr": {
            "analyzer": "lucene.french",
            "searchAnalyzer": "lucene.french",
            "type": "string"
          },
          "it": {
            "analyzer": "lucene.italian",
            "searchAnalyzer": "lucene.italian",
            "type": "string"
          },
          "pt": {
            "analyzer": "lucene.portuguese",
            "searchAnalyzer": "lucene.portuguese",
            "type": "string"
          }
        },
        "type": "string"
      }
    }
  },
  "synonyms": [
    {
      "analyzer": "lucene.standard",
      "name": "book-synonyms",
      "source": {
        "collection": "synonyms"
      }
    }
  ]
}

If I try for example to do:

{
  ...,
  "synonyms": [
    {
      "analyzer": "lucene.standard",
      "name": "book-synonyms",
      "source": {
        "collection": "synonyms"
      }
    },
    {
      "analyzer": "lucene.spanish",
      "name": "book-synonyms-es",
      "source": {
        "collection": "synonyms-es"
      }
    }
  ]
}

The error appears, right in the admin console.
I don’t think it is related to the document or the mapping itselft but to my cluster tier (M0 & M2).
Might it be?

I’ll provide a sample data-set, query and mapping for the 1st/first issue I described above but the root of the problem is this inability to add a second synonym.

Thanks for clarifying Ignacio.

As of now there are some limits related to Atlas Search and M0, M2/M5 tier clusters. I’m just checking if the below is related or if there’s other limits that may be causing this error:

Regards,
Jason

Just for clarification, in my case the synonyms collections has 32 docs.

Thanks @Ignacio_Larranaga,

I managed to reproduce this error (to some degree) - Could you confirm if your error includes a “2 > 1” at the end? See below:

Your index could not be built: Synonym mappings limit exceeded: 2 > 1

I just wanted to clarify if it was the exact same error message.

The team are looking into this to confirm in the mean time and I will update here if this is an undocumented limit or bug. Thanks for your patience.

Regards,
Jason

Yes, it said, 2 > 1 at the end. I guess 2 is just the number of entries in the array.

1 Like

Hi @Ignacio_Larranaga,

This error appears to be a related to a limit for free and shared tier clusters (M0,M2 and M5).

We are working to document this limit.

Thank you for raising this.

Regards,
Jason