title: Elastic Search combination of Range and Term filters
body: <p>I want to have a filter to return documents with <code>'re_max' &gt; 100</code> and <code>language_id = 28</code>. I did it this way:</p>
  
  <pre><code>{
    "query": {
      "filtered": {
        "filter": {
          "range": {
            "re_max": {
              "gt": 100
            }
          },
          "term": {
            "language_id": 28
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>But seems like it's not correct. how should I correct it?<br>
  This is the error:</p>
  
  <pre><code>{
    "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; 
              shardFailures {[WkgqspjtQzmPkW-YdvE1Qg][rep][0]: SearchParseException[[rep][0]: 
                from[-1],size[-1]: 
                Parse Failure [Failed to parse source [
                  {
                    "query": {
                      "filtered": {
                        "filter": {
                          "or": [
                            "range":
                            {
                              "re_max": {
                                "gt": 100
                              }
                            },
                            "term":
                            {
                              "language_id": 28
                            }
                          ]
                        }
                      }
                    }
                  }
                ]]]; 
              nested: QueryParsingException[[rep] Failed to parse]; 
              nested: JsonParseException[Unexpected character (':' (code 58)): 
                was expecting comma to separate ARRAY entries\n at [Source: [B@3d44a542; line: 6, column: 19]]; }{[WkgqspjtQzmPkW-YdvE1Qg][rep][4]: 
                SearchParseException[[rep][4]: from[-1],size[-1]: 
                  Parse Failure [Failed to parse source [
                    {
                      "query": {
                        "filtered": {
                          "filter": {
                            "or": [
                              "range":
                              {
                                "re_max": {
                                  "gt": 100
                                }
                              },
                              "term":
                              {
                                "language_id": 28
                              }
                            ]
                          }
                        }
                      }
                    }
                  ]]]; 
                nested: QueryParsingException[[rep] Failed to parse]; 
                nested: JsonParseException[Unexpected character (':' (code 58)): 
                  was expecting comma to separate ARRAY entries\n at [Source: [B@3d44a542; line: 6, column: 19]]; }{[WkgqspjtQzmPkW-YdvE1Qg][rep][3]: 
                  SearchParseException[[rep][3]: from[-1],size[-1]: 
                    Parse Failure [Failed to parse source [
                      {
                        "query": {
                          "filtered": {
                            "filter": {
                              "or": [
                                "range":
                                {
                                  "re_max": {
                                    "gt": 100
                                  }
                                },
                                "term":
                                {
                                  "language_id": 28
                                }
                              ]
                            }
                          }
                        }
                      }
                    ]]]; 
                  nested: QueryParsingException[[rep] Failed to parse]; 
                  nested: JsonParseException[Unexpected character (':' (code 58)): 
                    was expecting comma to separate ARRAY entries\n at [Source: [B@3d44a542; line: 6, column: 19]]; }{[WkgqspjtQzmPkW-YdvE1Qg][rep][2]: 
                    SearchParseException[[rep][2]: from[-1],size[-1]: 
                      Parse Failure [Failed to parse source [
                        {
                          "query": {
                            "filtered": {
                              "filter": {
                                "or": [
                                  "range":
                                  {
                                    "re_max": {
                                      "gt": 100
                                    }
                                  },
                                  "term":
                                  {
                                    "language_id": 28
                                  }
                                ]
                              }
                            }
                          }
                        }
                      ]]]; 
                    nested: QueryParsingException[[rep] Failed to parse]; 
                    nested: JsonParseException[Unexpected character (':' (code 58)): 
                      was expecting comma to separate ARRAY entries\n at [Source: [B@3d44a542; line: 6, column: 19]]; }{[WkgqspjtQzmPkW-YdvE1Qg][rep][1]: 
                      SearchParseException[[rep][1]: from[-1],size[-1]: 
                        Parse Failure [Failed to parse source [
                          {
                            "query": {
                              "filtered": {
                                "filter": {
                                  "or": [
                                    "range":
                                    {
                                      "re_max": {
                                        "gt": 100
                                      }
                                    },
                                    "term":
                                    {
                                      "language_id": 28
                                    }
                                  ]
                                }
                              }
                            }
                          }
                        ]]]; 
                      nested: QueryParsingException[[rep] Failed to parse]; 
                      nested: JsonParseException[Unexpected character (':' (code 58)): 
                        was expecting comma to separate ARRAY entries\n at [Source: [B@3d44a542; line: 6, column: 19]]; }]",
    "status": 400
  }
  </code></pre>