How to use filterQuery and queryOptions on cloudsearch boto3

I am trying to use boto3 and cloudsearchdomain but I am having troubles establishing some optional filters over my query. This is what I did:

response = client.search(
    query=query,
    filterQuery= {'city':city},
    partial=True,
    queryOptions= {'fields':'full_address'},
    queryParser='simple',
    size=size)

Based on the documentation of boto3, the filterQuery parameter should be an string, but I have no idea of the structure it should have and I found nothing on the internet. queryOptions should be a JSON, and this is what I am sending but I also retrieve an error message saying that it should be a string

ParamValidationError: Parameter validation failed:
Invalid type for parameter queryOptions, value: {'fields': 'full_address'}, 
type: <type 'dict'>, valid types: <type 'basestring'>

thank you, Álvaro

Upvotes: 1

Views: 1268

Answers (1)

I finally found the answer. I post it here just in case it can help other people with similar issues:

response = client.search(
    query="myquery",
    queryParser='simple',
    partial=True,
    queryOptions= '{"fields":["full_address"]}',
    filterQuery='city:33044'
    )

Upvotes: 3

Related Questions