Skip to content

Instantly share code, notes, and snippets.

View kosho's full-sized avatar

Kosho Owa kosho

View GitHub Profile
# Japan Population 2017
DELETE japan-population-2017
PUT japan-population-2017
{
"settings": {
"number_of_replicas": 0
, "number_of_shards": 1
},
# via http://apple.stackexchange.com/questions/39430/automatically-scan-cycle-through-safari-tabs
tell application "Safari"
repeat
repeat with i from (count of tabs of window 1) to 1 by -1
set current tab of window 1 to tab i of window 1
delay 10
end repeat
end repeat
end tell
input {
elasticsearch {
hosts => ["localhost:9200"]
index => ""
# user => "elastic"
# password => "changeme"
query => '{"query": {"match_all": {}}}'
}
}
filter {}
@kosho
kosho / elasticsearch-sql-examples.js
Last active August 20, 2018 08:48
Elasticsearch SQL Example with Apache Log for Webinar
##################################################
# Elasticsearch SQL Example with Apache Log
##################################################
#
# Operations
#
POST _xpack/sql
{
@kosho
kosho / function_score-query-example.js
Last active December 5, 2018 01:36
Usage example of Function Score Query to control search relevancy.
##################################################
# Function Score Query Example
##################################################
# Note: `now` should be replaced by `2018-12-06` for expected results
# Prepare for items index
DELETE items
PUT items
##################################################
# Cross Cluster Replication Example
##################################################
# On follower (remote), register "leader" (origin) cluster
PUT /_cluster/settings
{
"persistent" : {
"cluster" : {
##################################################
# Kuromoji/ICU Tokenizer comparison Test
##################################################
# config/userdict_ja.txt
# ルークスカイウォーカー,ルーク スカイウォーカー,ルーク スカイウォーカー,カスタム名詞
DELETE app-search-test
PUT app-search-test
@kosho
kosho / server.js
Created April 17, 2019 04:19
Elastic's APM enabled web service sample code
// Elastic's APM enabled web service sample code
var apm = require('elastic-apm-node').start({
serviceName: 'Sample web service',
secretToken: '',
serverUrl: ''
})
var http = require('http');
var server = http.createServer();