• linux虚拟机安装 Elasticsearch



    1.下载es

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.0-linux-x86_64.tar.gz
    解压安装即可
    启动不能使用root 用户 应该新创建用户


    2.java_home 需要重新指定 openjdk 11以上


    wget https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz

    修改 elasticsearch 下的bin/elasticsearch 
    在首行添加 

    #配置自己的jdk11
    export JAVA_HOME=/usr/local/src/jdk-11.0.1
    export PATH=$JAVA_HOME/bin:$PATH
    #添加jdk判断
    if [ -x "$JAVA_HOME/bin/java" ]; then
            JAVA="/usr/local/src/jdk-11.0.1/bin/java"
    else
            JAVA=`which java`
    fi

    3.编辑访问


    vim config下面的elasticsearch.yml

    宿主机无法访问虚拟机中 ElasticSearch服务

    
    network.host: 0.0.0.0
    http.port: 9200
    transport.host: localhost
    transport.tcp.port: 9300

    4.es 访问模式 


    <REST Verb> /<Index>/<Type>/<ID>


    5.聚合查询需要进行配置与优化

    curl -X PUT "localhost:9200/索引名/_mapping?pretty" -H 'Content-Type: application/json' -d'
    {
      "properties": {
        "字段名称": { 
          "type":     "text",
          "fielddata": true
        }
      }
    }

    如果在kibana里请执行如下

     PUT 索引名/_mapping
    {
      "properties": {
        "字段名称": { 
          "type":     "text",
          "fielddata": true
        }
      }
    }

    fielddata在text字段中默认未启用
    因为fielddata会消耗大量的堆内存,特别是当加载大量的text字段时;fielddata一旦加载到堆中,在segment的生命周期之内都将一致保持在堆中,所以谨慎使用

  • 相关阅读:
    pytest-html的更多功能
    pytest使用allure测试报告
    airtest+pytest实战教程02-APP页面元素获取
    airtest+pytest实战教程01-环境配置
    python发送邮件
    python获取文件名
    python生成GIF
    Selenium+Unittest自动化测试框架实战
    xpath定位和css定位
    Lucas(卢卡斯)定理模板&&例题解析([SHOI2015]超能粒子炮&#183;改)
  • 原文地址:https://www.cnblogs.com/liclBlog/p/15349463.html
Copyright © 2020-2023  润新知