AWS CloudSearch: how to search a large subset?

岁酱吖の 提交于 2019-12-11 05:39:41

问题


I simply want to search a large subset of ids within our CloudSearch index.

I have tried with a structured query (and also with a simple query plus a filterQuery), for example this narrows the search to three records only, those with item_key of 36933, 36940, or 36950.

(or (term field=item_key 'item_36933') (term field=item_key 'item_36940') (term field=item_key 'item_36950'))

This works, and it is obviously easy to expand that structured query to include many items. However, there seems to be a limit of 50 such terms in CloudSearch :-( which is a problem as I need to search sets of many more than 50 items, but still only a fraction of the overall index.

How can I do this, for an arbitrary set of say 1000 items, without resorting to searching the entire index and then filtering the results?


回答1:


CloudSearch supports 1024 clauses per search.

This means you can do a search against a field matching up to 1024 values, like

field_name: "value1" OR "value2" OR ... OR "value1024"

If your service needs to support more than 1024 individual matches, then you will need to split into multiple queries of 1024 and combine the results.



来源:https://stackoverflow.com/questions/47208275/aws-cloudsearch-how-to-search-a-large-subset

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