0

I want to index an array field, I have the next JSON

{
    "id": "invoice1",
    "sellers": [{
        "names": "Clark",
        "items": [{
            "iditem": "item1",
            "properties": [{
                "width": "212cm"
            }]
        }]
    }]
}

I would like to create an index in width propertie, I already used create index with

{
   "index": {
      "fields": [
         "sellers.[].items.[].properties.[].width"
      ]
   },
   "type": "json"
}

this is the answer in many posts but when I create the above index and when I query a selector

{
   "selector": {
      "sellers": {
         "$elemMatch": {
            "items": {
               "$elemMatch": {
                  "properties": {
                     "$elemMatch": {
                        "width": {
                           "$eq": "212cm"
                        }
                     }
                  }
               }
            }
         }
      }
   }
}

The response is

"warning": "no matching index found, create an index to optimize query time"
Julian Solarte
  • 555
  • 6
  • 29

0 Answers0