Question: i want to perform query like this on elastic search =>

select \* from orders where customerName = 'google' and Type = 'stackoverflow' and query\_string can be from any index. (i e query string can be 'google' or 'stackoverflow' or 'a' or 'b' or 'c 'or 'd'

```
table orders:
customerName   type              column1 column2 column3 column4
google         stackoverflow    a        b      c     d
apple         stackoverflow    a        b      c    d
google         stackoverflow    a        b      c     d
microsoft     stackoverflow    a        b      c     d

```

```
expected output:
google         stackoverflow    a        b      c     d
google         stackoverflow    a        b      c     d

```

i.e row 1 and row 3

i tried using

```
"query": {
                "bool": {
                    "must": {
                        "multi_match": {
                            "query": "b"
                        }
                    },
                    "filter": {
                        "terms": {
                            "customerName": [ "google" ],
                            "type": [ "stackoverflow ]
                        }
                    }
                }
            }

```

please help :)

Answer: 
You do not need the FileReader, you can set the image's source via `window.URL.createObjectURL`.

I am not sure why your code does not work, but I refactored and this solution works:
<https://jsfiddle.net/1pL4rqe2/>

I also added a directive to use the file input with `ng-change` ;)
That's the Angular way!
you should do that validation when the image file is selected.

I'm assuming you have a "file" element:

```
$('input[type="file"]').change(function(e){
let imgfile = new Image()
imgfile.src = window.URL.createObjectURL(e.target.files[0])
imgfile.onload = () => {
   imgWidth = imgfile.width;
   imgHeight = imgfile.height;
}
});

```

After this you'll have imgWidth and imgHeight variables so you can validate them as you please, disabling the upload button for example if the image size doesn't fit your needs etc.