Can i create a index like CREATE INDEX `type` ON `nosql`(`*`.`type`)


#1

Can i create a index like 'CREATE INDEX type ON nosql(*.type)'
where i wanted to apply index on all the documents with different types
Can some one help, Below is a sample document
{
“asset_file”: {
“file_name”: “SSNR/2/22/009”,
“status”: “1”,
“type”: “asset_file”,
“admin_store_id”: “68ff6943048cadda00099c2bb3c9d97c”,
“project_id”: “68ff6943048cadda00099c2bb3c9d97c”,
“date_added”: “2016-08-29T11:48:08Z”,
“date_modified”: “2016-08-29T11:48:08Z”,
“file_id”: “0a0084a07b897c1db6fa12c415875363”
}
}

If i can create how do i write the query.


#2

Yes. Please see the documentation first.


#3

Sorry to ask :
It is not applying for both the queries…

Explain SELECT * FROM nosql where *.type='asset_file’
explain SELECT * FROM nosql where asset_file.type=‘asset_file’

Can you send me the query if possible.


#4

Sorry, your queries are not following the documentation.

Can you look at an example of SELECT and WHERE.


#5

You mean the couchbase 4.5 documentation


#6

Yes. Within that documentation, there is a section and examples on N1QL. And within N1QL, there is documentation on the SELECT statement and on the WHERE clause.

After you get that working, we can look at indexing. We are here to help.