Non credo ci sia un modo build-in per questo, ma dovrebbe essere abbastanza facile da raggiungere tramite un terms facet
Cosa dovreste fare è:
- Salva tutte le query di parole chiave con un timestamp in un indice elasticsearch
- esegue una query match_all filtrata dal l'intervallo di tempo che ti interessa e applicare una sfaccettatura termine su di esso
Purtroppo non ho il tempo di scriverti un esempio, ma questo dovrebbe portarti alla soluzione.
Ecco un esempio:
// Demo index
curl -XDELETE 'http://localhost:9200/queries/'
curl -XPUT 'http://localhost:9200/queries/'
// Add some data
curl -XPUT 'http://localhost:9200/queries/query/1' -d '
{
"date": "2013-02-19T12:57:23",
"query": "Trying out ElasticSearch, so far so good?"
}'
curl -XPUT 'http://localhost:9200/queries/query/2' -d '
{
"date": "2013-03-02T11:27:23",
"query": "Lets give ElasticSearch another try"
}'
curl -XPUT 'http://localhost:9200/queries/query/3' -d '
{
"date": "2013-04-02T08:27:23",
"query": "OK, why dont we stick to SOLR?"
}'
curl -XPUT 'http://localhost:9200/queries/query/4' -d '
{
"date": "2013-04-19T11:27:23",
"query": "Couse ElasticSearch is so much cooler, its bonsai cool"
}'
// Query it
curl -XGET 'http://localhost:9200/queries/query/_search?pretty=true' -d '
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"date" : {
"gte" : "2013-01-01T00:00:00",
"lt" : "2013-04-01T00:00:00"
}
}
},
"query" : {
"match_all" : {}
}
}
},
"facets": {
"keywords": {
"terms": {
"field": "query"
}
}
}
}
'
Regolare l'intervallo di date nella query per vedere i cambiamenti dell'uscita
Grazie, lo esaminerò. Se hai tempo dopo, sentiti libero di scrivere un esempio. – flamecto
Ho aggiornato la risposta, spero che questo ti aiuti – Thorsten
Sembra buono, grazie ancora! – flamecto