elbilo
April 14, 2022, 11:00pm
1
I’m trying to create a primary index on the meta().id for a given bucket using this statement and getting this:
I’m running couchbase enterprise on a single node.
I’m patterning this command on the example in the couchbase documentation Indexing Metadata Information | Couchbase Docs
I don’t understand what I’m missing, I’ve tried several variations using back tics, specifying in the statement the bucket.scope.collection in the statement. What have I misunderstood in following the example?
dh
April 14, 2022, 11:09pm
2
A primary index doesn’t take field specification. You would issue:
CREATE PRIMARY INDEX ON programId;
(Ref: CREATE PRIMARY INDEX | Couchbase Docs )
HTH.
elbilo
April 14, 2022, 11:12pm
3
can I not create a “named” primary index? that was what I was trying to do?
dh
April 14, 2022, 11:18pm
4
You can:
CREATE PRIMARY INDEX myName ON myBucket;
HTH.
elbilo
April 14, 2022, 11:20pm
5
this is what I got to work:
CREATE PRIMARY INDEX programId
ON incentivePrograms
elbilo
April 14, 2022, 11:22pm
6
it’s not clear to me that the index was built on the document’s ID. for now I’ll assume so.
dh
April 14, 2022, 11:25pm
7
A primary index only indexes the document keys, so yes, it is on the ID.
Ref: Indexing and Query Performance | Couchbase Docs
Hope this clears things up for you.
2 Likes