Issue 1:
It would be useful to be able to return the net overlap/disjoint areas on a geo_shape query, so as to determine similarity of the queried shape to the indexed document.

Issue 2:
First, the use case:

To ensure a single, tested, artifact to be installed across the fleet, including all plugins needed, our build process roughly works like this:

Grab the version of ES as a debian package

Extract this debian package in a temp dir

cd into this directory and run: bin/plugin install ...

go back to the temp dir, and repackage as debian package

The reason for the debian package is that the init scripts for ES do a lot of work (setting ulimit, users, groups, etc), and we don't want to duplicate that and maintain it; otherwise we'd just use the tarball.

This process worked fine with 1.5.x, but starting 1.6, the 'plugin' command can no longer find the needed config files. Here are the specific issues:

Even though it finds 'CONF_DIR' just fine, it insists on setting 'CONF_FILE' separately, and does not use the same heuristics as for 'CONF_DIR'.

It now requires /etc/default/elasticsearch to be present to run, which requires an installed version, or another override.

The workaround is now to do this, which is ugly and prone to breakage going forward:

$ ES_INCLUDE=`pwd`/etc/default/elasticsearch CONF_FILE=`pwd`/etc/elasticsearch/elasticsearch.yaml CONF_DIR=`pwd`/etc/elasticsearch usr/share/elasticsearch/bin/plugin -h

The full diff below, to illustrate the offending parts:

diff elasticsearch-1.{5.2,6.0}/usr/share/elasticsearch/bin/plugin
23a26,62
> # Sets the default values for elasticsearch variables used in this script
> if [ -z "$CONF_DIR" ]; then
> CONF_DIR="/etc/elasticsearch"
>
> if [ -z "$CONF_FILE" ]; then
> CONF_FILE="$CONF_DIR/elasticsearch.yml"
> fi
> fi
>
> if [ -z "$CONF_FILE" ]; then
> CONF_FILE="/etc/elasticsearch/elasticsearch.yml"
> fi
>
> # The default env file is defined at building/packaging time.
> # For a deb package, the value is "/etc/default/elasticsearch".
> ES_ENV_FILE="/etc/default/elasticsearch"
>
> # If an include is specified with the ES_INCLUDE environment variable, use it
> if [ -n "$ES_INCLUDE" ]; then
> ES_ENV_FILE="$ES_INCLUDE"
> fi
>
> # Source the environment file
> if [ -n "$ES_ENV_FILE" ]; then
>
> # If the ES_ENV_FILE is not found, try to resolve the path
> # against the ES_HOME directory
> if [ ! -f "$ES_ENV_FILE" ]; then
> ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE"
> fi
>
> . "$ES_ENV_FILE"
> if [ $? -ne 0 ]; then
> echo "Unable to source environment file: $ES_ENV_FILE" >&2
> exit 1
> fi
> fi
48c87,96
< exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home="$ES_HOME" $properties -cp "$ES_HOME/lib/*" org.elasticsearch.plugins.PluginManager $args

---
> # check if properties already has a config file or config dir
> if [ -e "$CONF_DIR" ]; then
> case "$properties" in
> *-Des.default.path.conf=*|*-Des.path.conf=*)
> ;;
> *)
> properties="$properties -Des.default.path.conf=$CONF_DIR"
> ;;
> esac
> fi
49a98,110
> if [ -e "$CONF_FILE" ]; then
> case "$properties" in
> *-Des.default.config=*|*-Des.config=*)
> ;;
> *)
> properties="$properties -Des.default.config=$CONF_FILE"
> ;;
> esac
> fi
>
> export HOSTNAME=`hostname -s`
>
> exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home="$ES_HOME" $properties -cp "$ES_HOME/lib/*" org.elasticsearch.plugins.PluginManager $args