10 pieces of data sampled by elasticsearch

such as the title.

how does elasticsearch sample 10 items from millions of data, which ensure the ranking of correlation and try not to repeat the search with the same conditions in a small number of times.


if it's a sampling, you can use random numbers.

  1. each data sets a unique numeric sequence number to identify
  2. generate 10 non-repeating random numbers in the range
  3. use es's engine to calculate correlation (scores) in ES queries
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf13b1-31d63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf13b1-31d63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?