Autocomplete on search indexes should take into account embeddedDocuments

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Autocomplete
    • None
    • None
    • Developer Tools

      When creating a Search index, you can't use the dot syntax to access to a field in an object inside an array. For example, take the following document into consideration:

      {
         "movie": "Barbie",
         "topReviews": [
            { "score": 10, "review": "I'm just Ken" }
         ]
      } 

      If we want to create an index so we can search top reviews by text, it would be reasonable to try to define an index like this:

      {
         "mappings": {
            "fields": {
               "topReviews.review": {
                  "type": "string"
               }
            }
         }
      } 

      However, as review is an object inside an array of topReviews, this is not possible. We need to use the embeddedDocs type:

      {
         "mappings": {
            "fields": {
               "topReviews": {
                  "type": "embeddedDocument",            "fields": { "review": { "type": "string" } }
               }
            }
         }
      } 

      The autocomplete should be aware of the type of the document tree so it doesn't autocomplete with invalid index definitions.

      More documentation:

       

            Assignee:
            Unassigned
            Reporter:
            Kevin Mas Ruiz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: