Skip to content

Instantly share code, notes, and snippets.

View yanglikun's full-sized avatar
😀

yanglikun yanglikun

😀
View GitHub Profile
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<!--
基于google java style修改:https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml.
-->
<module name="Checker">
@yanglikun
yanglikun / es-index-option
Created July 8, 2017 06:12
es index option和搜索的关系
DELETE index_option_demo_index
PUT /index_option_demo_index
PUT /index_option_demo_index/_mapping/index_option_type
{
"index_option_type": {
"_all": {
"enabled": false
},
"properties": {
"analyzedDesc": {
@yanglikun
yanglikun / es-share-analyzer
Created July 3, 2017 08:13
es-share-解析
DELETE es_demo_analyzer_index
POST /es_demo_analyzer_index/
{
"settings": {
"index": {
"analysis": {
"analyzer":{
"myCustomAnalyzer":{
"type":"custom",
"tokenizer":"myCustomTokenizer",
@yanglikun
yanglikun / es-share-nearrealtime
Created July 1, 2017 06:12
es-share-实时和准实时
DELETE es_demo_time_index
#realTime :get API
PUT /es_demo_time_index/es_demo_time_type/1
{
"name":"name-1"
}
GET /es_demo_time_index/es_demo_time_type/1
#near real-time:get API
PUT /es_demo_time_index/es_demo_time_type/2
@yanglikun
yanglikun / es-share-baseOperator
Last active July 1, 2017 08:15
es-share-baseOperator
#show all index 相当于查看有哪些数据库 show databases
GET /_cat/indices?v
#create index 相当于执行DDL语句create database
PUT /es_demo_index
#create type(mapping) 相当于执行DDL语句create table
PUT /es_demo_index/_mapping/es_demo_order_type
{
"es_demo_order_type": {
@yanglikun
yanglikun / es-relation-parentchild
Last active June 29, 2017 06:16
es-关联关系-parentchild
DELETE relation_parentchild_index
PUT /relation_parentchild_index
#child must create before parent
PUT /relation_parentchild_index/_mapping/relation_child_type
{
"relation_child_type": {
"_parent": {
"type": "relation_parent_type"
},
@yanglikun
yanglikun / es-relation-nested
Last active June 28, 2017 12:10
es-关联关系-nested
DELETE relation_nested_index
PUT /relation_nested_index
PUT /relation_nested_index/_mapping/relation_nested_type
{
"relation_nested_type": {
"properties": {
"members": {
"type":"nested",
"properties": {
"firstName": {
@yanglikun
yanglikun / es-relation-object
Last active June 28, 2017 05:23
es-关联关系-object
DELETE relation_object_index
PUT /relation_object_index/relation_object_type/1
{
"projectName": "train",
"members": [
{
"firstName":"san",
"lastName":"zhang"
},{
@yanglikun
yanglikun / es-reindex.py
Created June 27, 2017 07:30
es-reindex
__author__ = 'yanglikun'
import elasticsearch
import elasticsearch.helpers
esSource=elasticsearch.Elasticsearch([{"host":"192.168.147.90","port":20000}])
esDestination=elasticsearch.Elasticsearch([{"host":"192.168.147.90","port":20000}])
sourceIndex="mock_project_index"
sourceType="mock_project_type"
mapping='''
@yanglikun
yanglikun / es-reindex.py
Created June 27, 2017 07:30
es-reindex
__author__ = 'yanglikun'
import elasticsearch
import elasticsearch.helpers
esSource=elasticsearch.Elasticsearch([{"host":"192.168.147.90","port":20000}])
esDestination=elasticsearch.Elasticsearch([{"host":"192.168.147.90","port":20000}])
sourceIndex="mock_project_index"
sourceType="mock_project_type"
mapping='''