Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13816

[Atlas Search] Document how to index arrays in Atlas Search

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: FTS
    • 3

      Description

      In Tutorial: Create and Query an Atlas Search Index we provide an example that indexes an array, but do not explicitly call out that we are indexing an array. We have received a number of questions on how to index arrays using Atlas Search. So customers are not finding this example. We should add a section on how to index arrays using Atlas Search. For reference the following explanation was provided to customers, which they found helpful:

      For example, in the sample_mflix database, movies contain a genres array. (Only showing title and genres to highlight that genres is an array of strings.)

      {
        "title" : "The Final Countdown",
        "genres" : [ "Action", "Sci-Fi" ]
      }
      

      We then define an index on genres, once again focusing on the genres portion of the index definition:

            "genres": {
              "type": "string",
              "analyzer": "lucene.standard"
            },
      

      Note how the type is string and not array, array[string], string[], or some other syntax. We define the index as the data type of the array elements and do not have to specify that the data is contained in an array. The fact that it is an array is automatically detected and handled by MongoDB.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            kanchana.sekhar@mongodb.com Kanchana Sekhar
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              3 years, 33 weeks, 2 days ago