Skip to content

Instantly share code, notes, and snippets.

View xyu's full-sized avatar
:shipit:

Xiao Yu xyu

:shipit:
View GitHub Profile
anonymous
anonymous / ES Function Score Visualization.markdown
Created April 11, 2016 04:16
ES Function Score Visualization

ES Function Score Visualization

Shows the score curves when given different settings for the three types of scoring functions available in Elasticsearch.

A Pen by Xiao Yu on CodePen.

License.

@xyu
xyu / es-function-score.js
Created April 11, 2016 01:23
Example of Elasticsearch function scoring with gaussian decay
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "...",
"fields": [
"title", "content", "author",
"tag.name", "category.name"
],
#!/usr/bin/env python
import argparse
import json
import random
import sys
def get_topic( args, data ):
topic = data['partitions'][0]['topic']
for partition in data['partitions']:
@xyu
xyu / hive-nginx.hql
Created January 1, 2016 20:33
Hive query to create table for parsing Nginx logs
-- Table for raw NGINX logs
CREATE EXTERNAL TABLE IF NOT EXISTS `raw_nginx_logs` (
`remote_addr` string,
`remote_user` string,
`time_local` string,
`http_verb` string,
`url` string,
`http_ver` string,
`status` int,
`body_bytes_sent` int,