title: How to query a list on AppSync GraphQL by a nested object
body: <p>I am using AWS AppSync GraphQL and am trying to filter a list by a nested object's value.</p>
  <p>My schema looks like this:</p>
  <pre><code>type Post @model {
      id: ID
      title: String
      content: String
      hidden: Boolean
  }
  
  type PinnedPost @model
  {
    id: ID!
    userID: ID @index(name: &quot;byUser&quot;, sortKeyFields: [&quot;postID&quot;])
    user: User @hasOne (fields: [&quot;userID&quot;])
    postID: ID
    post: Post @hasOne (fields: [&quot;postID&quot;])
  }
  </code></pre>
  <p>I would like to run a query to list the PinnedPost for a user, but filter out the hidden ones, like so:</p>
  <pre><code>const pinnedData = await API.graphql(graphqlOperation(             
    listPinnedPosts, {
       filter: {
        userID: {
          eq: userInfo.attributes.sub
        },
        post: {
          hidden: {
           eq: false
        },
       }
      }
    }
  ))
  </code></pre>
  <p>I have updated the filterinput in my Schema through the AppSync Console to:</p>
  <pre><code>input ModelPinnedPostFilterInput {
      id: ModelIDInput
      userID: ModelIDInput
      postID: ModelIDInput
      post: ModelPostFilterInput
      and: [ModelPinnedPostFilterInput]
      or: [ModelPinnedPostFilterInput]
      not: ModelPinnedPostFilterInput
  }
  </code></pre>
  <p>There are no errors associated with it, but the nested filter is not being applied as it will return both true and false values for hidden.</p>
  <p>This question was sort of answered before:</p>
  <p><a href="https://stackoverflow.com/questions/55132782/appsync-graphql-how-to-filter-a-list-by-nested-value">Appsync &amp; GraphQL: how to filter a list by nested value</a></p>
  <p>but it is not clear to me where I am supposed to edit the mapping template to allow this. How can I achieve this result?</p>