Added some conditionals to prevent unnecessary checking of elasticsearch filter sources