Skip to content

Instantly share code, notes, and snippets.

David Erickson derickson

Block or report user

Report or block derickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View elasticsearch_sql.json
## 1) Pull all records from index named fedeastsql
POST /_xpack/sql?format=txt
{
"query": "SELECT * FROM fedeastsql"
}
## 2) List all columns and datatype of this index
View abac with covery query proposal
PUT my_index
{
"mappings": {
"properties": {
"securityTags": {
"type": "keyword",
"fields": {
"length": {
"type": "token_count",
"analyzer": "standard"
View combinatorialSet.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
def prettyPrint(doc):
print(json.dumps(doc, indent=4, sort_keys=True))
View bigBool.json
{
"bool": {
"should": [
[
{
"bool": {
"must": [
[
{
"term": {
View ingestBeer.py
#!/bin/python3
import json
import moment
from elasticsearch import helpers
from elasticsearch import Elasticsearch
esConnString = 'http://elastic:changeme@localhost:9200'
esTo = Elasticsearch([esConnString],request_timeout=100)
View watcher examples .txt
### EXAMPLE SEARCH: Has Spotify run in the last 30 seconds?
GET /topbeat-*/_search
{
"query": {
"bool": {
"must": [
{"term": {
"proc.name": {
"value": "Spotify"
@derickson
derickson / spectator.html
Last active Aug 26, 2016
A-Frame spectator camera example code
View spectator.html
<html>
<head>
<script src="../dist/aframe.min.js"></script>
<script>
AFRAME.registerComponent('spectator',{
'schema': {
canvas: {
type: 'string',
default: ''
@derickson
derickson / logstash-bikehare-status.conf
Last active Feb 13, 2019
Logstash config for http_poller pulling of DC Capital bikeshare data and doing an XML split of the contents.
View logstash-bikehare-status.conf
## Example of pulling data from DC Capital bikeshare to Elasticsearch in real time
## HTTP Poller -> XML Splitting -> Elasticsearch
input {
## pull data from Capital Bikeshare every 60 seconds
http_poller {
urls => {
bikeshare_dc => "https://www.capitalbikeshare.com/data/stations/bikeStations.xml"
}
request_timeout => 30
@derickson
derickson / alias_filters.sense
Last active Aug 29, 2015
Quick test for Elasticsearch in sense to prove Alias filters correctly work with searches, facet term counts, and global aggregation. proves that term suggester doesn't respect alias filter
View alias_filters.sense
DELETE /foo
PUT /foo
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"people": {
@derickson
derickson / videogame2ES.py
Last active Aug 29, 2015
Experiment, pulling google spreadsheet data into ES
View videogame2ES.py
## Dependencies in order for this to work
## 1) google spreadsheet lib: https://github.com/burnash/gspread
## pip install gspread
## 2) oauth2 lib: http://gspread.readthedocs.org/en/latest/oauth2.html
## pip install oauth2client
## 3) create a "service account" in your google api console following the instructions from the oauth2 lib above
You can’t perform that action at this time.