Juan Cullen
Juan Cullen

Reputation: 98

A CloudSearch query to find records that has terms in a list

I need a AWS CloudSearch structured query that will help me find records where the field value is in a list.

For example, I want to find all records where category_id field values are found in '3,62,919,552,910'.

Upvotes: 0

Views: 1688

Answers (2)

dotcomly
dotcomly

Reputation: 2214

You can pass the fields to search separately and pass in a list of values like this:

aws cloudsearchdomain --endpoint-url https://search-mydomain.us-east-1.cloudsearch.amazonaws.com search --search-query '1|2|3' --query-options='{"fields":["category_id"]}'

Upvotes: 1

alexroussos
alexroussos

Reputation: 2681

There's no query syntax that takes a list; you have to combine all the elements in the list using a boolean OR:

q=(or category_id:3 category_id:62 category_id:919)&q.parser=structured

Upvotes: 1

Related Questions