I am fairly new to N1QL queries. I have some documents like this.
[
{
"id":"id_1",
"data":{
"name":"name_1"
},
"type":"type_1"
},
{
"id":"id_2",
"data":{
"name":"name_2"
},
"type":"type_2"
},
{
"id":"id_3",
"data":{
"name":"name_3"
},
"type":"type_3"
}
]
what index should i create to be able to get all the documents that have the "type"="type_3"
?
You can create an index like the one below to index all the documents of type type_3.
create index idx_type_3 on `bucket_name`.scope.collection(data) where type="type_3"