title: DynamoDB: How to use a query filter to check for conditions in a MAP
body: <p>I have a table and the structure looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/c1lMG.jpg" alt="DynamoDB document"></p>
  
  <p>When I do a query, I would like to be able to do a query filter on the data map; but I'm not exactly sure how to setup the query.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>HashMap&lt;String, AttributeValue&gt; map = new HashMap&lt;String, AttributeValue&gt;();
  map.put("byUserId", new AttributeValue().withS("vl49uga5ljjcoln65rcaspmg8u"));
  
  queryExpression
      .withQueryFilterEntry("data", new Condition()
          .withAttributeValueList(new AttributeValue().withM(map))
          .withComparisonOperator(ComparisonOperator.CONTAINS));
  </code></pre>
  
  <p>but the way I'm building the filter is not correct and I keep running into the following error:</p>
  
  <pre><code>Exception in thread "main" com.amazonaws.AmazonServiceException: One or more parameter values were invalid: ComparisonOperator CONTAINS is not valid for M AttributeValue type (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: CHIOME68L1HVGO81URD7CIOS6BVV4KQNSO5AEMVJF66Q9ASUAAJG)
      at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1077)
      at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:725)
      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:460)
      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:295)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:3106)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.query(AmazonDynamoDBClient.java:1118)
  </code></pre>
  
  <p>So what is a comparison operator I should be using (since IN is for list types), and how do I build the query filter such that I can specify a comparison inside of the MAP.</p>
  
  <p>Thanks!</p>