user2602740
user2602740

Reputation: 677

Query for field existence in CloudSearch

Suppose I have an optional field called 'xyz' in the list of documents I've indexed in CloudSearch.

How do I query CloudSearch so that it returns only those documents that contain 'xyz'?

If I know up front, that it's a positive integer, I can probably do something like this to get the required list: q=xyz:[0,}&q.parser=structured

But how do I do it if 'xyz' stores some other type like a string or a list of ints/strings etc.,?

BTW, I've used Solr before, and there, I could simply do q=xyz:* to achieve this. Does CloudSearch support such regular expressions?

Upvotes: 2

Views: 1387

Answers (1)

Muhammad Manazar
Muhammad Manazar

Reputation: 158

You can query for non empty values in a field using * operator, in your case its going to be xyz:* This will only work if you are using Lucene parser for your query to CloudSearch.

Upvotes: 1

Related Questions