Skip to content

Instantly share code, notes, and snippets.

@kuy
Last active July 23, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuy/fd9eddff387c6c1e1cf64c8bdbe1d443 to your computer and use it in GitHub Desktop.
Save kuy/fd9eddff387c6c1e1cf64c8bdbe1d443 to your computer and use it in GitHub Desktop.
Script
curl -XPOST 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "query": {
    "bool" : {
      "must" : {
        "term" : { "choice" : "B" }
      },
      "must" : {
        "script" : {
          "script" : {
            "inline" : "doc[\"choice\"].length == 1",
            "lang" : "painless"
          }
        }
      }
    }
  }
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment