title: How to apply faceted search in elastic search with multiple filters?
body: <pre><code>{
     path: '/xyz.com/electronics/1',
     body: {
          category: 'mobiles',
          product: 'apple iphone 6',
          brand: 'apple',
          mobile_name: 'iphone 6',
          price: 55000,
          os: undefined,
          memory: 16,
          ram: 2,
          3g: 1,
          wifi: 1,
          simtype: 1,
          screen: 5.1
     },
     query: {}
  }
  </code></pre>
  
  <p>Above given is a record of my elastic search index. I am trying to apply multiple filters on it depending upon what user requests for
  for ex price range between 2000-5000, wifi value 1, screen above 5 inches etc.</p>
  
  <p>I tried this:</p>
  
  <pre><code>client.search({
      index: "xyz.com",
      type: 'electronics',
      body: {
          "query": {
              "query_string": {
                  "query": "mobiles"
              }
          },
          "facets": {
              "format": {
                  "terms": {
                      "field": "brand"
                  }
              }
          }
      }
  })
  </code></pre>
  
  <p>How can I write a generic query for such filters?</p>