1. 程式人生 > >elk之es建立索引,新增分詞,拼音分詞

elk之es建立索引,新增分詞,拼音分詞

1.安裝pinyin外掛和ik外掛。

2.先建立type(kibana操作):

PUT article_v2018051101/
{
  "index": {
    "analysis": {
      "analyzer": {
        "ik_pinyin_analyzer": {
          "type": "custom",
          "tokenizer": "ik_smart",
          "filter": [
            "my_pinyin",
            "word_delimiter"
          ]
        }
      },
      "filter": {
        "my_pinyin": {
          "lowercase": "true",
          "type": "pinyin",
          "limit_first_letter_length": "16",
          "keep_original": "true",
          "keep_full_pinyin": "true",
          "keep_none_chinese ":"true",
          "keep_first_letter":"true",
          "keep_none_chinese_together":"true",
          "none_chinese_pinyin_tokenize":"true",
          "keep_original ":"true"
        }
      }
    }
  }
}  

3.建立mapping(article_category_index欄位添加了ik和pinyin分詞):

POST /article_v5251571/info/_mapping
{
  "info": {
    "properties": {
      "article_activity": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_activity_type": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_add_time": {
        "type": "date"
      },
      "article_brand_first_char": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_brand_id": {
        "type": "long"
      },
      "article_brand_logo": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_brand_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_category_id": {
        "type": "long"
      },
      "article_category_index": {
        "type": "text",
        "fields": {
          "pinyin": {
            "type": "text",
            "store": "no",
            "term_vector": "with_positions_offsets",
            "analyzer": "ik_pinyin_analyzer"
          }
        }
      },
      "article_category_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_distribution_area": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_freeshipping_area": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_goods_expenses": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_goods_no": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_id": {
        "type": "long"
      },
      "article_img_url": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_market_price": {
        "type": "float"
      },
      "article_old_sell_price": {
        "type": "float"
      },
      "article_order_times": {
        "type": "long"
      },
      "article_purchase_commodity_price": {
        "type": "long"
      },
      "article_review_score": {
        "type": "long"
      },
      "article_sell_price": {
        "type": "float"
      },
      "article_special_app_price": {
        "type": "long"
      },
      "article_sub_title": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_tags": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_title": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "article_user_category_id": {
        "type": "long"
      },
      "article_user_category_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "case_article_activity_type": {
        "type": "long"
      },
      "class_list": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "class_list_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "fav_times": {
        "type": "long"
      },
      "gift_rule": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "id": {
        "type": "long"
      },
      "is_activity": {
        "type": "long"
      },
      "is_free": {
        "type": "long"
      },
      "left_shop_send_area": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "pc_logo": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "pics": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "scope_values": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "score": {
        "type": "long"
      },
      "shop_brand": {
        "type": "long"
      },
      "shop_id": {
        "type": "long"
      },
      "shop_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "shop_order_times": {
        "type": "long"
      },
      "shop_review_score": {
        "type": "long"
      },
      "shop_send_area": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "thumb_path_arr": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "update_time": {
        "type": "date"
      },
      "vote_times": {
        "type": "long"
      },
      "wap_logo": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}
     
     

4.檢視mapping屬性:

get article_v5251571/_mapping

相關推薦

elkes建立索引新增拼音

1.安裝pinyin外掛和ik外掛。2.先建立type(kibana操作):PUT article_v2018051101/ {   "index": {     "analysis": {       "analyzer": {         "ik_pinyin_ana

ELKes】Centos7.3版本下安裝最新版elasticsearch6.3.2

text 監聽 分布式 proc sta trap 錯誤 支持 ets elasticsearch簡介 ElasticSearch是一個基於Lucene的搜索服務器。它提供了一個分布式多用戶能力的全文檢索引擎,基於RESTful web接口。Elasticsearch是用J

Qt小心得1: QWidget中新增Q_OBJECT巨集 setStyleSheet設定了背景顏色不顯示

          QWidget在沒有新增Q_OBJECT巨集,在建構函式裡用setStyleSheet設定了背景顏色,是可以正常顯示,但添加了Q_OBJECT巨集後,QWidget就無法顯示背景色了, 百度了一下,發現了類似問題,說是QWidge

ES 建立索引設定(setting)基礎

1.建立索引 PUT /my_index { "settings": { ... any settings ... }, "mappings": { "type_one": { ... any mappings ... },

Solr筆記四Solrj建立索引和搜尋的一般步驟

HttpSolrServer hss=new HttpSolrServer("http://localhost:8080/solr");SolrQuery sq=new SolrQuery("*:*");QueryResponse qr=hss.query(sq);SolrDocumentList list=

oracle建立表並新增主鍵設定主鍵自增長

oracle序列詳解和建立自增主鍵 Oracle序列主鍵 序列: 是oacle提供的用於產生一系列唯一數字的資料庫物件。 l 自動提供唯一的數值 l 共享物件 l 主要用於提供主鍵值

poiexcle----佔用多行新增背景色設定樣式

1 package com.poi.importxls; /* ==================================================================== Licensed to the Apache Software Fo

ES建立索引、投放文件過程

     因為之前對ES並不是太熟悉,實際工作時,在ElasticSearch和Kibanan的使用過程中,出現了好多棘手的狀況,修修補補,對於在ES上建立索引到插入文件,搜尋、查詢文件的整個流程,大概

elkes資料遷移

 安裝ElasticDumpnpm install elasticdump -g 在執行elasticdump --ignore-errors=true  --scrollTime=120m  --bulk=true --input=http://192.168.1.34:9

ElasticSearch 6.1.1 通過Head外掛新建索引新增文件及其查詢資料

ElasticSearch 6.1.1 通過Head外掛,新建索引,新增文件,及其查詢; 一、首先啟動相關服務: 二、新建一個film索引: 三、建立對映: 1、通過Head外掛: POST http://192.168.1.111:9200/film/_mappi

ES建立索引的過程

ES中建立索引的詳細分析總覽ES 建立索引最終都會呼叫 org/elasticsearch/index/engine/InternalEngine.java 中下面的方法:public IndexResult index(Index index) throws IOExcep

批量操作:更改密碼新增用戶添加ACL權限刪除用戶

img 刪除用戶 批量操作 新增 acl權限 info inf acl 改密 更改密碼 刪除用戶 設置ACL權限 添加用戶 批量操作:更改密碼,新增用戶,添加ACL權限,刪除用戶

.NET dropdownlist控制元件繫結資料後新增“全部”項實現功能

DropDownList在從資料庫中得到資料來源繫結後,計劃為其新增一個"全部"或"不限"之類的項,新增方法現知的有兩種:   1:在指令碼中直接新增:<asp:ListItem Value="0">全部</asp:ListItem>,然後在DropDownLi

和我一起打造個簡單搜索IK以及拼音

生產環境 ast ken ade usr block analyzer osi 繼續 elasticsearch 官方默認的分詞插件,對中文分詞效果不理想,它是把中文詞語分成了一個一個的漢字。所以我們引入 es 插件 es-ik。同時為了提升用戶體驗,引入 es-pinyi

和我一起打造個簡單搜尋IK以及拼音

elasticsearch 官方預設的分詞外掛,對中文分詞效果不理想,它是把中文詞語分成了一個一個的漢字。所以我們引入 es 外掛 es-ik。同時為了提升使用者體驗,引入 es-pinyin 外掛。本文介紹這兩個 es 外掛的安裝。 環境 本文以及後續 es 系列文章都基於 5.5.3 這個版本的 el

自動化測試Java+selenium新增四級地址定位方法

如果你遇到定位四級地址的定位問題,且你想簡化一下過程,或者你只是想著懶一下,不想一下一下地用xpath Copy到底,那麼,我這個方法就是寫給你的。 不多說了,直接上程式碼吧。 方法說明:(在頁面找到一個Flag,以它為中心,展開指令碼的編寫) //判斷Flag_Content,是否出現

mysql修改表名列名列型別新增表列刪除表列

alter table test rename test1; --修改表名 alter table test add column name varchar(10); --新增表列 alter table test drop column name; --刪除表列

python獲取tcp連線數新增連線數繪圖(用於效能測試過程中監控)

本指令碼可以用於有效能測試監控需求的人使用,用於tcp連線數的監控# -*- coding: UTF-8 -*- # author=baird_xiang import os import sys import time import re import copy new_

SpringBoot分散式管理新增日誌記錄註解配置與EhCache使用

    首先看下專案結構: 首先看下pom.xml配置的jar包:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins

rabbitmq 3.7.0版本新增trace外掛後新增報錯以及解決方案(可用方案)

在建立rabbitmq叢集環境後,為了跟蹤訊息消費機制,新增了trace外掛,具體指令碼請參考: # 檢視已安裝的外掛 ./rabbitmq-plugins list ./rabbitmq-plugins enable rabbitmq_tracing ./rabbitmqctl trace