简体   繁体   中英

AWS CloudSearch: how to search a large subset?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM