Elasticsearch list indices sorted by name

You can ask ES to sort the results via the s (sort) searchParameter using s=i or s=index curl “localhost:9200/_cat/indices?pretty&s=i” curl “localhost:9200/_cat/aliases?pretty&s=index” To see the column’s headers, add “&v” : curl “localhost:9200/_cat/indices?pretty&v&s=index”`. You can find some explanations in the cat/indices documentation

Kotlin sorting nulls last

You can use these functions from the kotlin.comparisons package: fun <T: Comparable<T>> nullsLast(): Comparator<T?>, which constructs a comparator of something comparable that just puts nulls after all not-null values; fun <T, K> compareBy(comparator: Comparator<in K>, selector: (T) -> K): Comparator<T>, which accepts a comparator and a function that provides values for the comparator, combining them …

Read more

How to sort 100GB worth of strings

A1. You probably want to implement some form of merge-sort. A2: Longer than it would if you had 256GB RAM on your machine. Edit: stung by criticism, I quote from Wikipedia’s article on merge sort: Merge sort is so inherently sequential that it is practical to run it using slow tape drives as input and …

Read more

Is std::pair ordering well-defined?

std::pair uses lexicographic comparison: It will compare based on the first element. If the values of the first elements are equal, it will then compare based on the second element. The definition in the C++03 standard (section 20.2.2) is: template <class T1, class T2> bool operator<(const pair<T1, T2>& x, const pair<T1, T2>& y); Returns: x.first …

Read more