-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Lorenzo Mangani edited this page Jan 14, 2018
·
4 revisions
Always make sure keyspace is correctly configured for Elassandra indexing.
ALTER KEYSPACE gun_db WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'DC1' : 1 } AND DURABLE_WRITES = true ;
Create mapping for gun_db.gun_data
with field auto-discovery and custom index on field soul
:
PUT gun_db
{
"mappings": {
"gun_data": {
"discover" : ".*",
"properties": {
"soul": {
"type": "text"
}
}
}
}
}
GET gun_db/_search
{
"query" : {
"match_all" : {}
}
}
GET gun_db/_search
{
"size": 0,
"aggs": {
"by_range": {
"range": {
"field": "state",
"ranges": [
{
"from": 1515860865490,
"to": 1515860865499
}
]
},
"aggs": {
"soul": {
"terms": {
"field": "soul"
},
"aggs": {
"relation": {
"terms": {
"field": "relation"
},
"aggs": {
"field": {
"terms": {
"field": "field"
},
"aggs": {
"value": {
"terms": {
"field": "value"
}
}
}
}
}
}
}
}
}
}
}
}