Skip to content

Instantly share code, notes, and snippets.

View penguinco's full-sized avatar

genta kaneyama penguinco

View GitHub Profile
@penguinco
penguinco / query.json
Created August 5, 2014 17:56
function score query
curl -o result.json 'http://localhost:9200/ldgourmet/restaurant/_search?pretty=true' -d '
{
"query" : {
"function_score" : {
"query" : {
"simple_query_string" : {
"query": "ハンバーガー",
"fields": ["name", "name_kana", "address"],
"default_operator": "and"
}

目的

検索用サーバーとして最近注目されているElasticsearchですが、ついに1.0 RC1がリリースされたそうです。 Googleトレンドを見ても、この分野で先行するApache Solrに迫る勢いを感じます。

<script type="text/javascript" src="//www.google.co.jp/trends/embed.js?hl=ja&q=Elasticsearch,+solr&cmpt=q&content=1&cid=TIMESERIES_GRAPH_0&export=5&w=500&h=330"></script>

そういうわけで私もElasticsearchについて興味を持って調べてみましたが情報がちょっと少ないですね…

  • 「調べたけど断片的な情報しかない」
  • 「公式doc英語だし、専門用語が多すぎてわからん」
#!/usr/bin/env python
""" Test HTTP Server
This script starts a http server that will respond to HTTP requests
with a predefined response.
Usage:
./http_server.py --port=8080 --code=404 --content="Page not Found"
@penguinco
penguinco / @naokiainoya-san
Last active August 29, 2015 13:56
elasticsearch session memo
@naokiainoya from リクルートテクノロジーズ
tech stack: AWS, node.js, elaticsearch, dynamo db
build own push notification service.
too detailed talk…
summary:
curl -XDELETE 'localhost:9200/test/'
curl -XPUT 'localhost:9200/test/' -d'
{
"index":{
"analysis":{
"tokenizer" : {
"kuromoji" : {
"type":"kuromoji_tokenizer",
"mode":"search"
}
@penguinco
penguinco / error.md
Last active December 15, 2015 03:29
IW error
$ curl 'http://localhost:8983/solr/core_name/update?commit=true' -H "Content-Type: text/xml" --data-binary '<add><doc><field name="id">3000000</field></doc></add>'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">500</int><int name="QTime">118</int></lst><lst name="error"><str name="msg">Error opening new searcher</str><str name="trace">org.apache.solr.common.SolrException: Error opening new searcher
        at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1267)
        at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1379)
$ wget http://redis.googlecode.com/files/redis-2.4.1.tar.gz
$ tar xzf redis-2.4.1.tar.gz
$ cd redis-2.4.1
$ make
$ make test
$ vi redis.conf
$ src/redis-server redis.conf
$ gem install redis
$ irb
@penguinco
penguinco / readme.txt
Created April 29, 2011 17:09
yats japanese user_ids api
You can get twitter user_ids who speak japanese.
MySQL dump file:deprecated.
JSON interface:
Query:
http://yats-data.com/yats/user_ids?id_autoinc=1260000&page=1
Params:
@penguinco
penguinco / fuba.json
Created January 30, 2011 10:44
for example
{"_id"=>BSON::ObjectId('4c72cb941d41c8640e00135a'),
"contributors_enabled"=>false,
"created_at"=>"Fri Apr 13 00:12:57 +0000 2007",
"description"=>"XBL:ecceecce, GameCenter:fuba, クレクレ厨",
"favourites_count"=>3523,
"follow_request_sent"=>false,
"followers_count"=>2693,
"following"=>true,
"friends_count"=>2629,
"geo_enabled"=>true,
@penguinco
penguinco / tutorial.rb
Created January 30, 2011 08:07
how to access twitter(ja) social graph dump
require 'rubygems'
require 'mongo'
require 'pp'
include Mongo
db = Connection.new.db('twitter')
profiles = db.collection('profiles')
friends = db.collection('friends')
pp "find by limit"