I\'m trying to do this query to my ElasticSearch Server.
{
\"query\" : {
\"match\" : {
\"name\" : \"network\"
}
},
\"
For anyone coming across this who migrated up major version(s) to elastic search 5, this filtered query is now depreciated and you should use a bool query instead. https://discuss.elastic.co/t/no-query-registered-for-filter/49602
match is a query, not a filter.
You probably want the term-filter in this case.
{
"query": {
"filtered": {
"query": { //THIS IS THE MAIN SEARCH BLOCK FOR ALL RESULTS
"match": {
"title": {
"query": "[MAIN_SEARCH_TERM]",
"minimum_should_match": "75%"
}
}
},
"filter": {
"bool": {
"must": [
{
"range": { //THIS FILTERS BY DATES GRATER THAN [SOME_DATE]
"date": {
"gte":"[SOME DATE]"
}
}
},
{
"geo_distance": { //THIS FILTERS BY GEO POINTS WITHIN [DISTANCE] of [LATITUDE], [LONGITUDE]
"distance": "[DISTANCE](mi, km)",
"location": {
"lat":"[LATITUDE]",
"lon":"[LONGITUDE]"
}
}
}
],
"should": [
{
"query": { //THIS FILTERS BY ANOTHER [MATCH_TERM] AND ADDS BOOST TO THAT TERM, YOU CAN USE MULTIPLE OF THESE WITH DIFFERENT [BOOST_INT]
"match": {
"[PROPERTY]": {
"query": "[MATCH_TERM]",
"boost": [BOOST_INT]
}
}
}
}
]
}
}
}
}
}
Reference Link: http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/query-time-boosting.html
Before using geo_point matching and date range filtering, make sure you understand _mapping: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping.html