I have few Google Datastore indexes I've added few months. Today I added another one. After few minutes, I found that this is not the right index that I have to create.
I called this:
$ gcloud datastore indexes list
---
ancestor: NONE
indexId: XXX1
kind: ThisIsKindName
projectId: GCP-PROJ-ID
properties:
- direction: ASCENDING
name: QueueName
- direction: ASCENDING
name: ExecutionLength
state: READY
---
ancestor: NONE
indexId: XXX2
kind: ThisIsKindName
projectId: GCP-PROJ-ID
properties:
- direction: ASCENDING
name: labels.application
- direction: DESCENDING
name: ExecutionLength
state: READY
---
...
And located the index to be removed (ID=XXX2
).
I found the cleanup command description and it's not clear to me. This function is asking to provide index.yaml
file.
What should be found in this file?
If your answer is going to be 1 (List of indexes to be kept) - How I can generate a yaml
file from my existing indexes? Its needed because I don't have those index definitions locally. Needed something like:
gcloud datastore indexes list --export=yaml
According to public documentation the command will remove any indexes that exist that are not included in the index.yaml file. Therefore in the index.yaml file be sure to only include the indexes that you are actively using.
As I am aware, there seems to be no particular means to generate a new index.yaml file, however, it seems that the best course of action would be to attempt to export the output of the command used:
gcloud datastore indexes list > index.yaml
(Alter the command to meet your CLI's needs)
And proceed to format it appropriately using the provided example as guidance.