Hatena::ブログ(Diary)

Solr, Python, MacBook Air in Shinagawa Seaside RSSフィード

2016-08-08

[] No results found になったときにやったこと メモ

画面右上の時計アイコンから、データの日時の範囲指定を変更する

デフォルトは Last 15 minutes になっているので

15分以上前のデータしかなければ 下記メッセージが出てグラフは表示されない

No results found 
Unfortunately I could not find any results matching your search. I tried really hard. I looked all over the place and frankly, I just couldn't find anything good. Help me, help you. Here are some ideas:

Expand your time range
I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking the time picker  in the top right corner of your screen.

Refine your query
The search bar at the top uses Elasticsearch's support for Lucene Query String syntax. Let's say we're searching web server logs that have been parsed into a few fields.

2016-07-28

[] 自然言語処理環境を作った メモ

Javaバージョンアップ
$ sudo yum -y install java-1.8.0-openjdk-devel
$ sudo alternatives --config java <- 1.8を選択する

Jython インストール
$ wget http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.7.0/jython-installer-2.7.0.jar
$ mv "remotecontent?filepath=org%2Fpython%2Fjython-installer%2F2.7.0%2Fjython-installer-2.7.0.jar" /tmp/jython-installer-2.7.0.jar
$ sudo su -
#  java -jar /tmp/jython-installer-2.7.0.jar -c
Welcome to Jython !
You are about to install Jython version 2.7.0
(at any time, answer c to cancel the installation)
For the installation process, the following languages are available: English, German
Please select your language [E/g] >>>
Do you want to read the license agreement now ? [y/N] >>>
Do you accept the license agreement ? [Y/n] >>>
The following installation types are available:
  1. All (everything, including sources)
  2. Standard (core, library modules, demos and examples, documentation)
  3. Minimum (core)
  9. Standalone (a single, executable .jar)
Please select the installation type [ 1 /2/3/9] >>> 2
Do you want to install additional parts ? [y/N] >>>
Do you want to exclude parts from the installation ? [y/N] >>>
Please enter the target directory >>> /usr/local/jython
Unable to find directory /usr/local/jython, create it ? [Y/n] >>>
Your java version to start Jython is: Oracle Corporation / 1.8.0_101
Your operating system version is: Linux / 4.4.11-23.53.amzn1.x86_64
Summary:
  - mod: true
  - demo: true
  - doc: true
  - src: false
  - ensurepip: true
  - JRE: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.101-3.b13.24.amzn1.x86_64/jre
Please confirm copying of files to directory /usr/local/jython [Y/n] >>>
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
Generating start scripts ...
Installing pip and setuptools
 90 %
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking setuptools
Downloading/unpacking pip
Installing collected packages: setuptools, pip
Successfully installed setuptools pip
Cleaning up...
 100 %
Do you want to show the contents of README ? [y/N] >>>
Congratulations! You successfully installed Jython 2.7.0 to directory /usr/local/jython.

$ sudo chmod -R 777 /usr/local/jython/cachedir

make環境インストール
$ sudo yum -y install gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel libffi-devel libxml2 libxslt libxml2-devel libxslt-devel sqlite-devel

rzsz
$ wget http://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
$ tar -xzvf lrzsz-0.12.20.tar.gz
$ cd lrzsz-0.12.20
$ ./configure --prefix=/usr/local
$ make
$ sudo su -
# make install
# cd /usr/local/bin
# ln -s lrz rz
# ln -s lsz sz

elasticsearch-py
$ sudo pip install elasticsearch
$ python
>>> from elasticsearch import Elasticsearch

$ sudo /usr/local/jython/bin/pip install elasticsearch
$ jython
>>> from elasticsearch import Elasticsearch

ICU
$ wget http://download.icu-project.org/files/icu4j/55.1/icu4j-55_1.jar
$ vi ~/.bash_profile
    export CLASSPATH=$CLASSPATH:/hoge/icu4j-55_1.jar


mvn
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
$ sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
$ sudo yum install -y apache-maven
$ mvn --version

mecab
$ wget http://mecab.googlecode.com/files/mecab-0.996.tar.gz
$ tar zvxf mecab-0.996.tar.gz
$ cd mecab-0.996
$ ./configure
$ make
$ sudo make install

mecab-python
$ sudo su -
# pip install https://mecab.googlecode.com/files/mecab-python-0.996.tar.gz
$ python
    import MeCab

UniDic
$ wget https://osdn.jp/projects/unidic/downloads/58338/unidic-mecab-2.1.2_src.zip
$ unzip unidic-mecab-2.1.2_src.zip
$ cd unidic-mecab-2.1.2_src
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
$ sudo vi /usr/local/etc/mecabrc 
    ; dicdir =  /usr/local/lib/mecab/dic/ipadic
    dicdir =  /usr/local/lib/mecab/dic/unidic
$ mecab
すもももももももものうち
すもも  スモモモモ名詞-普通名詞-一般
も      モ      モ      も      助詞-係助詞
もも    モモ    モモ名詞-普通名詞-一般
も      モ      モ      も      助詞-係助詞
もも    モモ    モモ名詞-普通名詞-一般
の      ノ      ノ      の      助詞-格助詞
うち    ウチ    ウチ    内      名詞-普通名詞-副詞可能
EOS

kuromoji 
$ sudo yum install git
$ cd ~/work
$ git clone https://github.com/atilika/kuromoji.git
$ cd kuromoji
$ mvn -pl kuromoji-unidic -am package <- メモリサイズ小さいと失敗する
$ vi ~/.bash_profile
CLASSPATH=$CLASSPATH:kuromoji-unidic/target/kuromoji-unidic-1.0-SNAPSHOT.jar:kuromoji-core/target/kuromoji-core-1.0-SNAPSHOT.jar

2016-07-27

[][] の バージョンアップ メモ

Jython 付属の pip で エラーになったので OpenJDK の バージョンを上げた

$ sudo yum -y install java-1.8.0-openjdk-devel
$ sudo alternatives --config java <- 1.8を選択する

2016-07-26

[][] を使う

Jython の pip を使ってインストール

$ sudo /usr/local/jython/bin/pip install elasticsearch

$ jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_101
Type "help", "copyright", "credits" or "license" for more information.
>>> from elasticsearch import Elasticsearch
>>>

[] ICU文字列正規化を行う

インストール

$ wget http://download.icu-project.org/files/icu4j/55.1/icu4j-55_1-docs.jar
$ vi ~/.bash_profile
    export CLASSPATH=$CLASSPATH:/hoge/icu4j-55_1.jar

#!/usr/local/jython/bin/jython
# -*- coding: utf-8 -*-

from com.ibm.icu.text import Transliterator

transliterator = Transliterator.getInstance('Fullwidth-Halfwidth')

def icu_normalize(text):
    normalized_text = transliterator.transliterate(text).lower()
    return normalized_text

if __name__ == "__main__":
 parseWord = u"BMW 320"

 print icu_normalize( parseWord )
]$ jython icu0.jy
bmw 320

[][] で UniDic 使う

1. make 環境 インストール

$ sudo yum -y install gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel libffi-devel libxml2 libxslt libxml2-devel libxslt-devel sqlite-devel

2. mvn インストール

$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
$ sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
$ sudo yum install -y apache-maven
$ mvn --version

3. mecab インストール ( mecab インストールしないと UniDic がインストールできない)

$ wget http://mecab.googlecode.com/files/mecab-0.996.tar.gz
$ tar zvxf mecab-0.996.tar.gz
$ cd mecab-0.996
$ ./configure
$ make
$ sudo make install
$ sudo su -
# pip install https://mecab.googlecode.com/files/mecab-python-0.996.tar.gz
$ python
    import MeCab

4. UniDic インストール

https://osdn.jp/projects/unidic/releases/58338
unidic-mecab-2.1.2_src.zip ダウンロード

$ unzip unidic-mecab-2.1.2_src.zip
$ cd unidic-mecab-2.1.2_src
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
$ sudo vi /usr/local/etc/mecabrc 
    ; dicdir =  /usr/local/lib/mecab/dic/ipadic
    dicdir =  /usr/local/lib/mecab/dic/unidic

5. kuromoji のインストール

$ git clone https://github.com/atilika/kuromoji.git
$ mvn -pl kuromoji-unidic -am package <- メモリサイズ小さいと失敗する
$ vi ~/.bash_profile
CLASSPATH=$CLASSPATH:kuromoji-unidic/target/kuromoji-unidic-1.0-SNAPSHOT.jar:kuromoji-core/target/kuromoji-core-1.0-SNAPSHOT.jar

6. Jythonテスト

#!/usr/local/jython/bin/jython
# -*- coding: utf-8 -*-

from com.atilika.kuromoji.unidic import Tokenizer

if __name__ == "__main__":
 parseWord = u"すもももももももものうち"
 tokenizer = Tokenizer()
 tokens = tokenizer.tokenize( parseWord )

 for token in tokens:
  print token.getSurface() + "\t" + token.getAllFeatures()
$ jython test.jy

すもも  名詞,普通名詞,一般,*,*,*,スモモ,李,すもも,スモモ,すもも,スモモ,和,*,*,*,*
も      助詞,係助詞,*,*,*,*,モ,も,も,モ,も,モ,和,*,*,*,*
もも    名詞,普通名詞,一般,*,*,*,モモ,桃,もも,モモ,もも,モモ,和,*,*,*,*
も      助詞,係助詞,*,*,*,*,モ,も,も,モ,も,モ,和,*,*,*,*
もも    名詞,普通名詞,一般,*,*,*,モモ,桃,もも,モモ,もも,モモ,和,*,*,*,*
の      助詞,格助詞,*,*,*,*,ノ,の,の,ノ,の,ノ,和,*,*,*,*
うち    名詞,普通名詞,副詞可能,*,*,*,ウチ,内,うち,ウチ,うち,ウチ,和,*,*,*,*

[] EC2Mavenインストールする メモ

$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
$ sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
$ sudo yum install -y apache-maven
$ mvn --version