Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| # tmux v2.0 installation steps for Ubuntu 14.04 (Trusty Tahr) | |
| tmux -V | |
| sudo apt-get update | |
| sudo apt-get install -y python-software-properties software-properties-common | |
| sudo add-apt-repository -y ppa:pi-rho/dev | |
| sudo apt-get update | |
| sudo apt-get install -y tmux | |
| tmux -V | |
| # tmux v1.9 installation steps for Ubuntu 14.04 (Trusty Tahr) |
| curl -XPOST http://localhost:9200/test/articles/1 -d '{ | |
| "content": "The quick brown fox" | |
| }' | |
| curl -XPOST http://localhost:9200/test/articles/2 -d '{ | |
| "content": "What does the fox say?" | |
| }' | |
| curl -XPOST http://localhost:9200/test/articles/3 -d '{ | |
| "content": "The quick brown fox jumped over the lazy dog" | |
| }' | |
| curl -XPOST http://localhost:9200/test/articles/4 -d '{ |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| # need to install htpasswd to set user and password for elasticsearch, if htpasswd not found then install following package | |
| sudo apt-get install apache2-utils |
| ### Install Oracle Java 8, this means you agree to their binary license!! | |
| cd ~ | |
| sudo add-apt-repository -y ppa:webupd8team/java | |
| sudo apt-get update | |
| echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
| echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections | |
| sudo aptitude -y install oracle-java8-installer | |
| ### Download and Install ElasticSearch |
| # Using Ubuntu | |
| curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - | |
| sudo apt-get install -y nodejs | |
| # Using Debian, as root | |
| curl -sL https://deb.nodesource.com/setup_4.x | bash - | |
| apt-get install -y nodejs |
| # install pip via apt-get | |
| sudo apt-get install python-pip python-dev build-essential | |
| sudo pip install --upgrade pip | |
| The MIT License (MIT) | |
| Copyright (c) 2015 Justin Perry | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| this software and associated documentation files (the "Software"), to deal in | |
| the Software without restriction, including without limitation the rights to | |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
| the Software, and to permit persons to whom the Software is furnished to do so, | |
| subject to the following conditions: |
| import redis | |
| import threading | |
| class Listener(threading.Thread): | |
| def __init__(self, r, channels): | |
| threading.Thread.__init__(self) | |
| self.redis = r | |
| self.pubsub = self.redis.pubsub() | |
| self.pubsub.subscribe(channels) | |
| import re | |
| def print_match(match): | |
| if match is None: | |
| print 'No match' | |
| return | |
| print match.group() | |
| return match |