mobz/elasticsearch-head — pull request #44 by cbcase (2013-01-25 00:48:26+00:00)
Title: Fix issue with structured query with multiple "should" clauses

When you add multiple "should" clauses in a structured query, the removeClause() function is called multiple times, since the default clause is itself a "should" clause. On the later calls, indexOf() returns -1, causing whichever "should" clause is last to get spliced out. This PR updates removeClause() to check that the clause-to-remove is present before splicing it out.