2

I try to make a query with filtering but it fails, Bad Request comes as reponse

{
                "query":{
                    "filtered":{        
                        "query":{
                              "logdate":{
                                 "gte":"01-01-2014"
                            }
                        }
                    }
                }
            }

I search documentation online and see it works as same part of my code but something in there is not true that I cant figure out

1 Answer 1

1

you seem "query" tag in filter comment in online documentation of elasticsearch or elsewhere ? lol never go there. Use "filter" tag in filtered query and also you must add "range" field. here This is the true form of your query

{  
  "query":{  
    "filtered":{  
      "filter":{  
        "range":{  
          "logdate":{  
            "gte":"01-01-2014"
          }
        }
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

2 Comments

I tried but its not work. And I didnt say ı copy it from elasticsearch documentation. Just inspired someone's queries. anyway I need something else I think
It work fine for me, Are you sure you set mapping your index ? Can you post definition of index ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.