Skip to content

Instantly share code, notes, and snippets.

{
"_id" : ObjectId("5063114bd386d8fadbd6b004"),
"name" : "Brian D. Goodman",
"organizations" : ["MongoDB"],
"locations" : [
{ "type" : "work",
"address" : "229 W 34 St., 5th floor",
"city" : "New York",
"state" : "NY",
"zipcode" : "10036"
{ "_id" : ObjectId("5063114bd386d8fadbd6b004"),
"name" : "Brian D. Goodman",
"organizations" : ["MongoDB”],
"locations" : [
{ "type" : "work",
"address" : "229 W 34 St., 5th floor",
"city" : "New York",
"state" : "NY",
"zipcode" : "10036"
}
{
"_id" : ObjectId("5063114bd386d8fadbd6b004"),
"name" : "Brian D. Goodman",
"organizations" : ["MongoDB"],
"locations" : [
{ "type" : "work",
"address" : "229 W 34 St., 5th floor",
"city" : "New York",
"state" : "NY",
"zipcode" : "10036"
SELECT *
FROM Samples."samples.dremio.com"."SF_incidents2016.json"
import pandas as pd
import elasticsearch
import json
es = elasticsearch.Elasticsearch() # Assume Elasticsearch is running on localhost
dataset_url = "https://data.cityofnewyork.us/api/views/43nn-pn8j/rows.csv?accessType=DOWNLOAD"
df = pd.read_csv(dataset_url, header=0, sep=',',
dtype={'PHONE': str, 'INSPECTION DATE': str, 'ZIPCODE': str})
$curl -s http://localhost:9200/restaurants/inspections/_count | jq '.'
{
"count": 410649,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
}
}
SELECT BORO, COUNT(*) c
FROM production.restaurants.inspections
GROUP BY BORO
ORDER BY c DESC
{
"size": 0,
"query": {
"match_all": {}
},
"aggregations": {
"BORO": {
"terms": {
"field": "BORO",
"missing": "NULL_STRING_TAG",
SELECT CUISINE_DESCRIPTION, COUNT(*) c
FROM production.restaurants.inspections
WHERE contains(VIOLATION_DESCRIPTION:(mice OR vermin))
GROUP BY CUISINE_DESCRIPTION
ORDER BY c DESC
{
"size": 0,
"query": {
"query_string": {
"query": "VIOLATION_DESCRIPTION : (mice OR vermin )"
}
},
"aggregations": {
"CUISINE_DESCRIPTION": {
"terms": {