如何在AWS放大graphql模式中按非主键查询

时间:2019-07-22 19:54:47

标签: indexing amazon-dynamodb graphql aws-amplify

我在aws-amplify,appsync中有一个graphql模式。

我的模式是:

type Project 
  @model 
  {
    id: ID!
    project_number: String!
    name: String!
    architect: String!
    interfaces: [Interface] @connection(name: "ProjectInterfaces")

  }
type Interface
  @model 
  {
    id: ID!             
    interface_name: String!
    version: String!
    release: String!              
    source_feature: String!
    MFT_feature_id: String!
    state: String!
    source_application: String!     
    source_env: String!               
    source_go_live: String!              
    source_payload: String! 
    source_payload_format: String!
    source_payload_volume: String!              
    source_protocol: String! 
    target_application: String!       
    target_env: String!
    target_go_live: String!
    target_payload: String!
    target_payload_format: String!
    target_payload_volume: String!             
    target_protocol: String!
    frequency: String!                
    authentication: String!
    payload_security: String!
    transport_security: String!
    network_paths: String!
    project: Project @connection(name: "ProjectInterfaces")
  }

,我想知道是否可以通过project_number而不是id搜索项目界面。我在project_name上添加了一个索引,但它似乎不起作用。我当前的查询是

query GetProject {
  getProject(project_number:"P200") {
    name
    architect
    interfaces{
      items{
        interface_name
        version
        release              
        source_feature
        MFT_feature_id
        state
        source_application     
        source_env             
        source_go_live          
        source_payload
        source_payload_format
        source_payload_volume         
        source_protocol
        target_application  
        target_env
        target_go_live
        target_payload
        target_payload_format 
        target_payload_volume       
        target_protocol
        frequency                
        authentication
        payload_security
        transport_security
        network_paths 
      }
    }
  }
}

请告诉我是否可行。我希望它可以仅按project_name进行搜索,然后从界面中获取所有详细信息。

0 个答案:

没有答案