본문 바로가기
BigDATA/couchbase

org.springframework.dao.DataRetrievalFailureException: Query error: [{"msg":"No primary index on keyspace lineup-test. Use CREATE PRIMARY INDEX to create one.","code":4000}]

by 태하팍 2016. 3. 15.
반응형

Error Message

org.springframework.dao.DataRetrievalFailureException: Query error: [{"msg":"No primary index on keyspace lineup-test. Use CREATE PRIMARY INDEX to create one.","code":4000}]


Query

Executing Query: SELECT v1 FROM `lineup-test` WHERE v2 = "12"


Solution

/opt/couchbase/bin/cbq

cbq>  CREATE PRIMARY INDEX ON `lineup-test` USING GSI;

{

    "requestID": "f75f9210-cf8d-4312-b469-d7dd28e866a1",

    "signature": null,

    "results": [

    ],

    "status": "success",

    "metrics": {

        "elapsedTime": "2.387898008s",

        "executionTime": "2.387748206s",

        "resultCount": 0,

        "resultSize": 0

    }

}


Data

{

  "airportname": "Seattle Tacoma Intl",

  "city": "Seattle",

  "country": "United States",

  "faa": "SEA",

  "geo": {

    "alt": 433,

    "lat": 47.449,

    "lon": -122.309306

  },

  "icao": "KSEA",

  "id": 3577,

  "type": "airport",

  "tz": "America/Los_Angeles"

}



Result

http://localhost:8080/lineup/v1/findAll?query=SEA

query : SELECT airportname FROM `lineup-test` WHERE faa = "SEA"



 


반응형

'BigDATA > couchbase' 카테고리의 다른 글

문제해결) 로딩만 하다가 타임아웃 나는 현상..  (0) 2016.04.19