Basic principles/Best practice for CREATE INDEX in N1QL

Are there some basic principles/best practice for CREATE INDEX in N1QL?
Using INDEX can increase query efficiency,but If I am using wrong INDEX , or unnecessarily INDEX maybe cause query Inefficient.
I has read brief introduction to query planning,it is good introduction for understanding query planing.
but I am still confused in CREATE INDEX to increase query efficiency.
As I understand,

  1. I should make my N1QL to using KeyScan first,
  2. then I should also CREATE INDEX base on my where clause (As query planing shows, reduce FILTER operation,increase IndexScan operation?)?
  3. When use KeyScan(such as JOIN operation),make sure add more filter condition as possible?
  4. may be avoid to use some function?

May be a blog included following topic about INDEX will be good:

  1. For a given N1QL, How should I analyze N1QL to design INDEX?
  2. How should I choose index If I have more than one INDEX CREAT choice?
  3. How should I trace INDEX efficiency when a query execute?
  4. some basic principles/best practice?

This document also helped to understand how query works. but Can any one explain how Optimizer works in detail?
This document is also helpful to understand index,but how should I create different type of index and how should I recognize different type of index by EXPLAIN command?

See this for introduction to N1QL query planning. It’s a year old but the description is relavant.

N1QL query planning

Couchbase now has HINTS for index selection, etc.