How can I write a N1QL

How can I write a N1QL queries which uses Local Index (MapReduce Views ). I could not find any useful link. Please help me.

You cannot use manually created views with N1QL queries.
There is a deprecated way to create simple indexes USING VIEW;

What’s your view definition?

I was just trying out Local and Global indexes with CB. Then I realised that local indexes can be created using queries or through the Couchbase management UI using the “ADD VIEW” button under Indexes Tab( Couchbase CE 5.1.0). But when I create a View using “ADD VIEW” method I can not use them in the N1QL queries. So what is the use of these created VIEWS ? Am I missing some other benefits/functionalities this Views going to give me ?

What’s your view definition?
I am starting a new Project and I was playing with Couchbase Views. No specific View Definition.

Thanks

Views are used directly execute from SDKs. cc @Siri
Views : https://developer.couchbase.com/documentation/server/3.x/admin/Views/views-intro.html

If you are using new project you should explore N1QL+GSI index.

https://developer.couchbase.com/documentation/server/5.1/indexes/indexing-overview.html
https://developer.couchbase.com/documentation/server/5.1/n1ql/n1ql-language-reference/index.html

Yes, Views are available directly via REST API and SDK.

In general, to build an index into data, the right tools would be GSI (Global Secondary Index) and access path to them would be through Query (N1QL) service.

To write programmatic logic that runs in response to data mutations, or needs to do something based on wallclock time, you should look at Eventing service. https://developer.couchbase.com/documentation/server/5.5/eventing/eventing-overview.html