Skip to content

Instantly share code, notes, and snippets.

@mhinze
mhinze / README.txt
Created Mar 17, 2016 — forked from mattweber/README.txt
ElasticSearch Multi-Select Faceting Example
View README.txt
This is an example how to perform multi-select faceting in ElasticSearch.
Selecting multiple values from the same facet will result in an OR filter between each of the values:
(facet1.value1 OR facet1.value2)
Faceting on more than one facet will result in an AND filter between each facet:
(facet1.value1 OR facet1.value2) AND (facet2.value1)
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh).
View redis-server-for-init.d-startup
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
View gist:161473
public static bool IsSubclassOfOpenGeneric(this Type type, Type generic)
{
// fine!
return type != typeof(object) &&
(generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type) ||
type.BaseType.IsSubclassOfOpenGeneric(generic));
}