2014-02-09 1 views
2

며칠 전에 Datastore에 새로운 모델을 도입했습니다. 놀랍게도 나는 아직도 색인 경고 인덱스 내가하시기 바랍니다 실종 무엇 DataStore IndexesGAE에서 색인 경고를 해결하는 방법은 무엇입니까?

enter image description here

indexes: 

# AUTOGENERATED 

# This index.yaml is automatically updated whenever the dev_appserver 
# detects that a new type of query is run. If you want to manage the 
# index.yaml file manually, remove the above marker line (the line 
# saying "# AUTOGENERATED"). If you want to manage some indexes 
# manually, move them above the marker line. The index.yaml file is 
# automatically uploaded to the admin console when you next deploy 
# your application using appcfg.py. 


- kind: FeelTrackerRecord 
    ancestor: yes 
    properties: 
    - name: record_date 
    - name: timestamp 

에서 제공하더라도

W 2014-02-09 03:38:28.480 
suspended generator run_to_queue(query.py:938) raised NeedIndexError(no matching index found. 
The suggested index for this query is: 
- kind: FeelTrackerRecord 
    ancestor: yes 
    properties: 
    - name: timestamp) 

W 2014-02-09 03:38:28.480 
suspended generator helper(context.py:814) raised NeedIndexError(no matching index found. 
The suggested index for this query is: 
- kind: FeelTrackerRecord 
    ancestor: yes 
    properties: 
    - name: timestamp) 

를 얻을?

+0

예외가 발생하는 코드를 표시해야합니다. 로그에는 제안 된 색인에 대한 하나의 특성 만 표시됩니다. 아마도 timestamp 속성에 대해 조상 (ancestor) 필터와 불평등 필터가있는 쿼리가 있는데,이를 위해 앱 엔진에서 사용할 것을 요구하는 인덱스가 필요합니다. – loki

+1

나열된 색인이 권장 색인과 일치하지 않습니다. 그들은 정확히 일치해야합니다 –

답변

0

의견에서 언급 한 색인이 필수 항목과 일치하지 않습니다. 이 오류는

raised NeedIndexError(no matching index found. 
The suggested index for this query is: 
- kind: FeelTrackerRecord 
    ancestor: yes 
    properties: 
    - name: timestamp) 

인덱스하면 목록이

- kind: FeelTrackerRecord 
    ancestor: yes 
    properties: 
    - name: record_date 
    - name: timestamp 

당신은 차이를 볼 수 있나요 다른 당신을이다 그러나 말한다?

나열된 색인을 추가하고 색인을 업데이트하십시오.

+0

새로운 GAE 프로젝트를 시작할 때마다이 오류가 계속 발생합니다. index.yaml이 정확한지 확신합니다. 난 그냥 로컬 GoogleAppEngineLauncher에 의해 생성 된 하나를 커밋하고, 그것은 오류에서 제안 된 것과 정확히 같습니다. 이 문제는 잠시 후 "스스로 해결"되는 것으로 보이지만 그 일이 언제 발생하는지는 분명치 않습니다. – Jonny

3

마침내 문제가 발견되었습니다.

가장 좋은 방법은 로컬 index.yaml이 비어 있는지 확인하는 것입니다 (모든 색인 삭제). 그런 다음 localhost에서 GAE 응용 프로그램을 실행하고 예상대로 응용 프로그램에 액세스하십시오. 의 HTTP 액세스 브라우저를 통해 매우 간단하고 GET 경우/REST를 통해 POST는 터미널에서 curl을 사용할 수 있습니다 필요합니다

GET :

curl --user [email protected]:test123 http://localhost:8080/api/v1.0/records/1391944029 

POST :

curl --user [email protected]:test123 http://localhost:8080/api/v1.0/records/1391944029 -d '{"records": [ 
     { 
      "notes": "update", 
      "record_date": "2014-02-02", 
      "timestamp": 1391944929 
     } 
    ], "server_sync_timestamp": null}' -X POST -v -H "Accept: application/json" -H "Content-type: application/json" 

GAE는 이제 index.yaml을 자동으로 업데이트하고 여기에 올바른 색인을 추가합니다.

앱을 배포 한 후 이전 색인을 정리해야합니다. 이는 터미널을 통해 수행됩니다

appcfg.py vacuum_indexes src 

자격 증명을 사용하여 로그인 한 후에는 더 이상 index.yaml에있는 기존 인덱스에 대해 물어볼 것입니다 그들은 삭제해야합니다. y를 누르고 계속하십시오.

+1

그래, 조금 직관적이지 않지만이 작품. – Isaac

관련 문제