代码之家  ›  专栏  ›  技术社区  ›  Manjoor

在googleappengine上修改/删除数据存储索引

  •  2
  • Manjoor  · 技术社区  · 14 年前

    <datastore-index kind="TBL" ancestor="false"> 
        <property name="Col1" direction="asc" /> 
        <property name="Col2" direction="desc" />
        <property name="Col3" direction="asc" />
        <property name="Col4" direction="asc" />
        <property name="Col5" direction="asc" />
        <property name="Col6" direction="asc" />
        <property name="Col7" direction="asc" />
        <property name="Col8" direction="asc" />                         
    </datastore-index>  
    

    我的新web.xml是

    <datastore-index kind="TBL" ancestor="false"> 
        <property name="Col1" direction="asc" /> 
        <property name="Col2" direction="desc" />
        <property name="Col3" direction="asc" />
        <property name="Col4" direction="asc" />
        <property name="Col5" direction="asc" />
        <property name="Col6" direction="desc" />
        <property name="Col7" direction="asc" />
        <property name="Col8" direction="asc" />                         
    </datastore-index>  
    

    TBL  
    ------------
    Col2 ▲ , Col1 ▲ , Col6 ▼  
    Col4 ▲ , Col1 ▲ , Col6 ▼  
    Col5 ▲ , Col8 ▲ , Col1 ▲ , Col6 ▲ => I got error for this index
    Col8 ▲ , Col1 ▲ , Col6 ▲   
    Col1 ▲ , Col2 ▼ , Col3 ▲ , Col4 ▲ , Col5 ▲ , Col7 ▲ , Col8 ▲ 
    Col1 ▲ , Col2 ▼ , Col3 ▲ , Col4 ▲ , Col5 ▲ , Col6 ▼ , Col7 ▲ , Col8 ▲ 
    Col1 ▲ , Col7 ▲  
    Col1 ▲ , Col6 ▲  
    Col1 ▲ , Col6 ▼  
    

    第三个索引出现索引未找到错误。我想修改所有索引中col6的方向,并将其设置为“desc”。

    我该怎么做?或者如何删除索引?

    有人吗?

    3 回复  |  直到 14 年前
        2
  •  1
  •   Kanishk Gupta    6 年前

    我的环境/流程:

    • 我在一个名为“datastore indexes.xml”的文件中定义和维护(添加、删除等)我的索引。
    • 我使用Maven任务“mvn”构建和部署我的WAR文件
    • 我使用“mvn”部署索引appengine:deployIndex“任务。

    1. Open the Google Cloud SDK Shell, and cd to the directory with the "index.yaml" file.
    
    2. In the shell, type "gcloud datastore indexes cleanup index.yaml"
    
    3. It will prompt you to continue, and it will further notice indexes in the Cloud Datastore, that are not defined in the local "index.yaml" file.
    
    4. Here it will prompt you to delete these indexes.
    

    我认为你不能更新索引,只能删除(旧的)和添加(新的)索引。

        3
  •  0
  •   Zaaier    6 年前

    现在(2019-02-06)可以通过以下方式完成:

    gcloud datastore indexes cleanup <INDEX_FILE>

    https://cloud.google.com/sdk/gcloud/reference/datastore/indexes/cleanup