SELECT random rows with flexible search query

51
January 12, 2019, at 04:20 AM

I am trying to create a Flexible Search that retrieves 10,000 random rows out of 3M. Tried with different syntax like LIMIT, but i cannot make it work, I need to add this query to a Groovy Script. Thought about creating a random number and retrieve 10k from all the rows, but performance will be heavy.

Any suggestions?

Query Example:

SELECT {pk} FROM {Order as O} "Condition to get random registries from it".

Thank you!!

Answer 1

You can't do that directly with Flexible search.

One solution would be to query the IDs of your Orders, then get random ID's from your list using Java (you can easily find how to do it on StackOverflow).

Once you have random IDs you can build an other Flexible search to query the full rows.

READ ALSO
how to access mySQL server in kubernetes

how to access mySQL server in kubernetes

I have created a MySQL deployment in kubernetes and exposed it as nodes-portI can access it from inside the cluster using kubectl run -it --rm --image=mysql:5

65
Indexing a MySQL table containing LONGTEXT field into Elastic Search

Indexing a MySQL table containing LONGTEXT field into Elastic Search

The table contains a LONGTEXT field that has special characters including quotes and commas

54
how to set collation_server and character_set_ server from utf8 to utf8mb4 and utf8mb4_unicode_ci?

how to set collation_server and character_set_ server from utf8 to utf8mb4 and utf8mb4_unicode_ci?

I have tried following this website https://mathiasbynensbe/notes/mysql-utf8mb4#utf8-to-utf8mb4, but i can't able to find collation_server which is in my

57