Hi,
I'm trying to build a facets search where i need to retrieve only the facets count data.
This search needs to be on a date range and to match some fields values.
That's my mapping:
{
"mappings": {
"log": {
"properties": {
"session": {"type": "string"},
"visitor": {"type": "string"},
"bot": {"type": "integer"},
"site": {"type": "integer"},
"access": {"type": "date", "format" : "yyyy-MM-dd HH:mm:ss"},
"request": {"type": "string", "index" : "not_analyzed"},
"referer": {"type": "string", "index" : "not_analyzed"},
"first": {"type": "integer"},
"ip": {"type": "ip"},
"user_agent": {"type": "string"},
"city": {"type": "string", "index" : "not_analyzed"},
"country": {"type": "string", "index" : "not_analyzed"},
"ll": {"type": "geo_point"}
}
}
}
}
And that's my search, i'm sure that i made something wrong to the criteria (terms and range) be true to only retrieve data from that range, and bot=0 and site=49210 and first=1
I'm new using ES, but only reading the documentation doesn't helped to understand my error on this query.
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"access" : {
"to" : "2013-09-12 23:59:59",
"from":"2013-09-12 00:00:00"
}
}
},
"query" : {
"term" : {
"bot" : "0"
}
},
"query" : {
"term" : {
"site" : "49210"
}
},
"query" : {
"term" : {
"first" : "1"
}
}
}
},
"facets" : {
"request" : {
"terms" : {
"field" : "referer",
"size" : "10",
"exclude" : ["",null]
}
}
},
"size" : "0"
}