title: ElasticSearch Error: [term] query does not support different field names, use [bool] query instead
body: <p>I am currently using <strong>ElasticSearch v2.3.2</strong> and am having an issue debugging an error in the query. The query seems to be working fine, but it is still throwing an error:</p>
  
  <blockquote>
    <p>[query_parsing_exception] [term] query does not support different
    field names, use [bool] query instead</p>
  </blockquote>
  
  <p>My current ElasticSearch query is as follows:</p>
  
  <pre><code>var must = [];
  
  must.push({ not: { term: { 'zip': '00000' }}});
  
  var request = {
      index: 'my-index',
      type: 'property',
      body: {
          from : page * perPage,
          size : perPage,
          query: {
              bool: {
                  must,
                  filter : [
                      {
                          geo_distance : {
                              distance : range + 'mi',
                              'position' : point
                          }    
                      },
                      {
                          "not" : {
                              "term" : {
                                      "listing.rentForSale" : "R",
                                      "listing.statusCode" : "Rented"
                              }
                          }
                      }
                  ]
  
              }
          },
          sort: [{
              _geo_distance: {
                  "position": point,
                  "order":         "asc",
                  "unit":          "mi",
                  "distance_type": "plane"
              }
          }]
      }
  };
  </code></pre>
  
  <p>My initial query had the <strong>"not"</strong> clause inside the <strong>must array</strong> as follows:</p>
  
  <pre><code>var must = [];
  
  must.push({ not: { term: { 'zip': '00000' }}});
  must.push({ not: { term: { "listing.rentForSale" : "R" }}});
  must.push({ not: { term: { "listing.statusCode" : "Rented" }}});
  
  var request = {
      index: 'my-index',
      type: 'property',
      body: {
          from : page * perPage,
          size : perPage,
          query: {
              bool: {
                  must,
                  filter : [
                      {
                          geo_distance : {
                              distance : range + 'mi',
                              'position' : point
                          }    
                      }
                  ]
  
              }
          },
          sort: [{
              _geo_distance: {
                  "position": point,
                  "order":         "asc",
                  "unit":          "mi",
                  "distance_type": "plane"
              }
          }]
      }
  };
  </code></pre>
  
  <p>This did not yield the correct results. Moving the <strong>"not" clause</strong> into the <strong>filter array</strong> now yields the correct search results, but it still throws this error. Any ideas how i can clear this error?</p>