Search code examples
amazon-web-servicesurlencodeamazon-cloudsearch

CloudSearch filtered query works in test dashboard but not on search endpoint


I need to filter my search by the host. I was able to do this in the CloudSearch Dashboard under "Run a Test Search" (See picture)

enter image description here

Awesome! That was easy. Except not awesome. I'm going crazy trying to get that to work with my actual search endpoint.

This I would assume should give me the same results as the dashboard test query, but it isn't filtering them at all.

https://search.endpoint/?q.parser=structured&q='hello%20test'&fq=host:'example.com'

I've tried using the Structured Query language, Lucene, and DisMax for query parsing, but I can't get it working on any of them.

https://search.endpoint/?q.parser=lucene&q=hello%20test&fq=host:'example.com'
https://search.endpoint/?q.parser=dismax&q=hello%20test&fq=host:'example.com'

What am I doing wrong?


Solution

  • I didn't make one thing super clear. I am using a custom domain instead of the default endpoint.

    Turns out I only had a small handful of query string parameters set up in my API in API Gateway.

    Once I added the additional query strings to the API I was able to make the queries.

    I also learned that you can generate your test search as a URL by clicking on the view raw: JSON button. That has helped speed things up a lot!