{"action":"created","issue":{"url":"https://api.github.com/repos/guardian/grid/issues/1084","labels_url":"https://api.github.com/repos/guardian/grid/issues/1084/labels{/name}","comments_url":"https://api.github.com/repos/guardian/grid/issues/1084/comments","events_url":"https://api.github.com/repos/guardian/grid/issues/1084/events","html_url":"https://github.com/guardian/grid/pull/1084","id":100650312,"number":1084,"title":"boolFilter for archived field - take 2","user":{"login":"akash1810","id":836140,"avatar_url":"https://avatars.githubusercontent.com/u/836140?v=3","gravatar_id":"","url":"https://api.github.com/users/akash1810","html_url":"https://github.com/akash1810","followers_url":"https://api.github.com/users/akash1810/followers","following_url":"https://api.github.com/users/akash1810/following{/other_user}","gists_url":"https://api.github.com/users/akash1810/gists{/gist_id}","starred_url":"https://api.github.com/users/akash1810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash1810/subscriptions","organizations_url":"https://api.github.com/users/akash1810/orgs","repos_url":"https://api.github.com/users/akash1810/repos","events_url":"https://api.github.com/users/akash1810/events{/privacy}","received_events_url":"https://api.github.com/users/akash1810/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-12T22:38:12Z","updated_at":"2015-08-13T10:33:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/guardian/grid/pulls/1084","html_url":"https://github.com/guardian/grid/pull/1084","diff_url":"https://github.com/guardian/grid/pull/1084.diff","patch_url":"https://github.com/guardian/grid/pull/1084.patch"},"body":"Take 1 - https://github.com/guardian/grid/pull/1078\r\n\r\nUsing `boolFilter` on the `archived` field to determine if an image can be deleted.\r\n\r\nExecutes the following query, where `<IMAGE_ID>` is an existing image id.\r\n\r\n[Elastic reference](https://www.elastic.co/guide/en/elasticsearch/guide/current/combining-filters.html#_nesting_boolean_filters).\r\n\r\n```sh\r\ncurl -XGET 'http://localhost:9200/_search' -d '\r\n{\r\n\t\"query\": {\r\n\t  \"bool\": {\r\n\t    \"must\": {\r\n\t      \"match\": {\r\n\t        \"_id\": {\r\n\t          \"query\": \"<IMAGE_ID>\",\r\n\t          \"type\": \"boolean\"\r\n\t        }\r\n\t      }\r\n\t    }\r\n\t  }\r\n\t},\r\n\t\"filter\": {\r\n\t  \"and\": {\r\n\t    \"filters\": [\r\n\t      {\r\n\t        \"missing\": {\r\n\t          \"field\": \"exports\",\r\n\t          \"null_value\": true,\r\n\t          \"existence\": true\r\n\t        }\r\n\t      },\r\n\t      {\r\n\t        \"missing\": {\r\n\t          \"field\": \"identifiers.picdarUrn\",\r\n\t          \"null_value\": true,\r\n\t          \"existence\": true\r\n\t        }\r\n\t      },\r\n\t      {\r\n\t      \t\"bool\": {\r\n\t      \t\t\"should\": [\r\n\t      \t\t\t{ \r\n\t      \t\t\t\t\"missing\": {\r\n\t\t      \t\t\t\t\"field\": \"userMetadata.archived\",\r\n\t\t      \t\t\t\t\"null_value\": true,\r\n\t\t      \t\t\t\t\"existence\": true\r\n\t      \t\t\t\t} \r\n\t      \t\t\t},\r\n\t      \t\t\t{\r\n\t      \t\t\t\t\"bool\": {\r\n\t      \t\t\t\t\t\"must\": [\r\n\t      \t\t\t\t\t\t{ \"term\": { \"userMetadata.archived\": false } }\r\n\t      \t\t\t\t\t]\r\n\t      \t\t\t\t}\r\n\t      \t\t\t}\r\n\t      \t\t]\r\n\t      \t}\r\n\t      }\r\n\t    ]\r\n\t  }\r\n\t}\r\n}'\r\n```"},"comment":{"url":"https://api.github.com/repos/guardian/grid/issues/comments/130606432","html_url":"https://github.com/guardian/grid/pull/1084#issuecomment-130606432","issue_url":"https://api.github.com/repos/guardian/grid/issues/1084","id":130606432,"user":{"login":"akash1810","id":836140,"avatar_url":"https://avatars.githubusercontent.com/u/836140?v=3","gravatar_id":"","url":"https://api.github.com/users/akash1810","html_url":"https://github.com/akash1810","followers_url":"https://api.github.com/users/akash1810/followers","following_url":"https://api.github.com/users/akash1810/following{/other_user}","gists_url":"https://api.github.com/users/akash1810/gists{/gist_id}","starred_url":"https://api.github.com/users/akash1810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash1810/subscriptions","organizations_url":"https://api.github.com/users/akash1810/orgs","repos_url":"https://api.github.com/users/akash1810/repos","events_url":"https://api.github.com/users/akash1810/events{/privacy}","received_events_url":"https://api.github.com/users/akash1810/received_events","type":"User","site_admin":false},"created_at":"2015-08-13T10:33:16Z","updated_at":"2015-08-13T10:33:16Z","body":"I put it on TEST last night and it did :)"}}