Query for field existence in CloudSearch

人盡茶涼 提交于 2019-12-24 05:48:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!