Filtering data in elasticsearch 1.7 php

HI all!
I am trying to filter my products and i have some problems with query..
here is my mapping in attached file
mapping.json
Here is my query.

          `$query = [
                    'query'=>[
                        'filtered'=>[
                                 'query'=>[
                                            ['term'=>['language'=>$lang]], //current language
                                       ],
                             'filter'=>[
                                  ['terms'=>['manufacturer_id'=>$manufacturerId]],//array of manufacturers
                                  ['terms'=>['attribute_id'=>$attributeId]],//array of attributes
                                  ['term'=>['category_id'=>$categoryId]],//id of current category which comes from $_GET
                                  [
                                      'range'=>[
                                           'price'=>[
                                              'gte'=>$gte,
                                             'lte'=>$lte
                                          ]
                                  ]

                          ],
                   ]
               ]
          ];`

All parameters i am getting from $_GET
And some of parameters like manufacturer_id, attribute_id, price can be empty in $_GET
But category_id, language is required and it cant be empty.
And when i want to filter by manufaturer_id i am sending and array but i dont want to filter by attribute_id and it is empty.
My query doesn't return correct data because it needs an attribute_id .but it is empty array.
So how write a query which will ignore statement if the value from $_GET is empty.

The second problem (if you saw my mapping you will understand what i mean)
I have

          ` "properties" : { //root properties object
                   //another props here 
                   "productOnly" : {
                      "properties" : {
                        ......
                        "price" : {
                          "type" : "float"
                        }
                      }
                    }
             }`

so how can i refer to price in range filter?
i tried somethind like this productOnly.price but it didnt works

Third problem.
I have a productToCategory array of objects
here is mapping

          ` "properties" : {//root properties object
                   //another props here 
                     "productOnly" : {},
                    "productToCategory" : {
                      "properties" : {
                        "category_id" : {
                          "type" : "integer"
                        },
                        "id" : {
                          "type" : "integer"
                        },
                        "product_id" : {
                          "type" : "integer"
                        }
                      }
                    }
             }`

And i tried to refer like this

['term'=>['productToCategory.category_id'=>$categoryId]],

but it didnt works
Please help)