问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/23773474/query-for-field-existence-in-cloudsearch