Can replace faceting (facets api deprecated in ES). Lots of options.
- min aggregation
- max aggregation
- sum aggregation
- avg aggregation
- stats aggregation
- extended stats aggregation
- value count aggregation
- percentiles aggregation
- percentile ranks aggregation
- cardinality aggregation
- geo bounds aggregation
- top hits aggregation
- scripted metric aggregation
- global aggregation
- filter aggregation
- filters aggregation
- missing aggregation
- nested aggregation
- reverse nested aggregation
- children aggregation
- terms aggregation
- significant terms aggregation
- range aggregation
- date range aggregation
- ipv4 range aggregation
- histogram aggregation
- date histogram aggregation
- geo distance aggregation
- geohash grid aggregation
Queries
curl -XGET "http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search?search_type=count" -d '{
"query": {
"term": {
"content_data.title": "football"
}
},
"aggregations": {
"my_agg": {
"terms": {
"field": "ext_publication"
}
}
}
}
'Search type: Count
Counts are approximate.
curl -XGET 'http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search?search_type=count' -d '{
"aggregations": {
"my_agg": {
"terms": {
"field": "content_data.sites"
}
}
}
}
'curl -XGET 'http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search?search_type=count' -d '{
"query": {
"term": {
"content_data.sites": "cougarfan"
}
},
"aggregations": {
"my_agg": {
"terms": {
"field": "content_data.title"
}
}
}
}
'Response
{
"took": 197,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"hits": {
"total": 2136801,
"max_score": 0,
"hits": []
},
"aggregations": {
"my_agg": {
"buckets": [
{
"key": "dnews",
"doc_count": 18519
},
{
"key": "national",
"doc_count": 3157
},
{
"key": "cougarfan",
"doc_count": 2151
},
{
"key": "common",
"doc_count": 16
},
{
"key": "ddm",
"doc_count": 5
},
{
"key": "utah",
"doc_count": 3
},
{
"key": "ksl",
"doc_count": 1
}
]
}
}
}In order to use some suggesters (completion), you have to specify it in the mapping.
You could solve with queries, but suggestions are faster. They can be used in addition to search.
- term: word alternatives on a per-token basis
- phrase: select entire corrected phrases
- completion (requires mapping changes)
http://cms-elastic-test.deseretdigital.com:9200/_stats
http://cms-elastic-test.deseretdigital.com:9200/contentindex/_stats
http://cms-elastic-test.deseretdigital.com:9200/contentindex/_stats/docs
http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_stats
- Document counts
- Index disk usage
- Flush / merge / etc stats
- Average query & fetch time
- Everything else you ever wanted, maybe
http://cms-elastic-test.deseretdigital.com:9200/_cluster/stats
http://cms-elastic-test.deseretdigital.com:9200/_nodes/stats
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/controlling-relevance.html
Simple
curl -XGET "http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search" -d '{
"query": {
"fuzzy": {
"content_data.title": "futebol"
}
}
}
'More options
curl -XGET "http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search" -d '{
"query": {
"fuzzy": {
"timestamp_modified": {
"value": "2014-10-10T00:00:00",
"fuzziness": "1d"
}
}
}
}
'curl -XGET "http://cms-elastic-test.deseretdigital.com:9200/contentindex/ContentProfile/_search" -d '{
"query": {
"boosting": {
"positive": {
"match": {
"content_data.sites": "cougarfan"
}
},
"negative": {
"match": {
"title": "BYU"
}
},
"negative_boost": 0.1
}
}
}
'