zoukankan      html  css  js  c++  java
  • elasticsearch安装和基础

    下载安装

    安装或升级JDK(Java SE Development Kit 8)

    java -version
    echo $JAVA_HOME
    

    下载Elasticsearch程序压缩包并解压,以2.2.1为例:

    curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.2.1/elasticsearch-2.2.1.tar.gz
    tar -xvf elasticsearch-2.2.1.tar.gz
    cd elasticsearch-2.2.1
    

    分词插件

    IK,找到对应的版本。
    Mmseg

    以daemon方式elasticsearch启动(需要非root账户)

    bin/elasticsearch -d
    

    Logstash启动

     bin/logstash -f config/jdbc.conf
    

    其中jdbc.conf为配置文件。

    名词解释

    索引(index)

    相当于SQL数据库的数据库(database)

    类型(type)

    相当于SQL数据库的数据表(table)

    文档(document)

    相当于SQL数据库的数据记录或行(record or row)

    字段(Field)

    相当于SQL数据库的数据列(column)

    映像(mapping)

    相当于SQL数据库的数据模式(schema)

    权重(boosting)

    用于增加权重,例如title^5表示分数(score)加到5倍

    解析器(analyzer)

    用于解析Index,包含一个Tokenizer。

    Elasticsearch ships with a wide range of built-in analyzers, which can be used in any index without further configuration.
    Analyzers are composed of a single Tokenizer and zero or more TokenFilters. The tokenizer may be preceded by one or more CharFilters. The analysis module allows you to register Analyzers under logical names which can then be referenced either in mapping definitions or in certain APIs.

    POST _analyze
    {
        "analyzer": "whitespace",
        "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
    }
    

    分词(tokenizer)

    用于解析字符串,成为terms或tokens

    A tokenizer receives a stream of characters, breaks it up into individual tokens (usually individual words), and outputs a stream of tokens.
    Tokenizers are used to break a string down into a stream of terms or tokens. A simple tokenizer might split the string up into terms wherever it encounters whitespace or punctuation.

    POST _analyze
    {
      "tokenizer": "whitespace",
      "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
    }
    

    过滤器(filter)

    建议(suggester)

    用于搜索建议
    一共有四种:

    • Term suggester
    • Phrase Suggester
    • Completion Suggester
    • Context Suggester
  • 相关阅读:
    web前端node.js常用命令
    常见的一部份面试题
    JavaScript基础语法
    表单属性、标签
    文字美化学习总结
    JS-实现横向手风琴
    Js-带进度条的轮播图
    canvas-八卦图和时钟实现
    JS-闭包练习
    JS-上下文练习
  • 原文地址:https://www.cnblogs.com/lilongsy/p/6640276.html
Copyright © 2011-2022 走看看