Search code examples
couchbasesql++

Trying to create partition index but creating replica index in Couchbase Why?


I'm trying to create a partitioned index using the below query in Couchbase

CREATE INDEX adv_firstOpen ON data(state, name, zip, status) 
WHERE type = 'Event' and name = 'firstOpen'
WITH {"num_partition":4, 
"nodes":["node1:9001", "node2:9001", "node3:9001","node4:9001" ]}

but creating replication index

enter image description here

what is the issue in creating an index query?


Solution

  • After reading the Couchbase document got an idea to create a proper index

    CREATE INDEX adv_firstOpen ON data(state, name, zip, status) 
    PARTITION BY HASH(state) 
    WHERE type = 'Event' and name = 'firstOpen' WITH {"num_partition":4}
    

    here num_partition is enough in with condition and PARTITION BY HASH must be mention

    enter image description here