elasticsearch 全文检索    2017-07-19 20:46:15    1068

为了学习elasticsearch,跟着官方文档及网上例子操作了一些,整理记录下来,以供大家参考。

本文所用测试工具:火狐插件HttpRequester。
elasticsearch:2.3

----------------------------------------创建index---------------------------------------------

Content-Type: application/json

 -- response --
200 OK
Content-Type:  application/json; charset=UTF-8
Content-Length:  21

{"acknowledged":true}

----------------------------------------查询index---------------------------------------------


 -- response --
200 OK
Content-Type:  application/json; charset=UTF-8
Content-Length:  361

{
  "megacorp1" : {
    "aliases" : { },
    "mappings" : { },
    "settings" : {
      "index" : {
        "creation_date" : "1467844960627",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "3luuvHNGSf2RBYJHxRGUNg",
        "version" : {
          "created" : "2030399"
        }
      }
    },
    "warmers" : { }
  }
}

----------------------------------------创建type--------------------
saiku mondrian 缓存 OpenBI    2017-07-19 20:45:01    844

saiku提供了刷新缓存的方法:

org.saiku.web.rest.resources.OlapDiscoverResource.refreshConnections()
或者页面调用URL:http://localhost:8090/saiku/rest/saiku/anonymousUser/discover/refresh
        其最终刷新Mondrian缓存的方法是:
        


 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

elasticsearch restful    2017-07-19 20:41:59    925
为了学习elasticsearch,跟着官方文档及网上例子操作了一些,整理记录下来,以供大家参考。
本文所用测试工具:火狐插件HttpRequester。
elasticsearch:2.3

----------------------------------------创建文章---------------------------------------------
Content-Type: application/json
{
    "first_name" : "John",
    "last_name" :  "Smith",
    "age" :        25,
    "about" :      "I love to go rock climbing",
    "interests": [ "sports", "music" ]
}
 -- response --
200 OK
Content-Type:  application/json; charset=UTF-8
Content-Length:  127

{"_index":"megacorp","_type":"employee","_id":"1","_version":6,"_shards":{"total":2,"successful":1,"failed":0},"created":false}
----------------------------------------查询文章---------------------------------------------


 -- response --
200 OK
Content-Type:  application/json; charset=UTF-8
Content-Length:  278

{
  "_index" : "megacorp",
  "_type" : "employee",
  "_id" : "1",
  "_version" : 6,
  "found" : true,
  "_source" : {
    "first_name
mondrian saiku schema OpenBI    2017-07-19 20:38:42    867

整理此文章方便大家做测试(手写Mondrian Schema自测),不必每次都向saiku上传文件了

关键文件

  • foodmart4.xml 测试对应的schema文件
  • foodmart-sql.zip 测试对应的数据库脚本

maven项目:
pom文件

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>cn.firewarm</groupId>
  5. <artifactId>testMondrian</artifactId>
  6. <packaging>war</packaging>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>testMondrian Maven Webapp</name>
  9. <url>http://maven.apache.org</url>
  10. <repositories>
  11. <repository>
  12. <id>mine</id>
  13. <name>public Releases</name>
  14. <layout>default</layout>
  15. <url>http://nexus.liuyingguang.cn:8081/nexus/content/groups/public/</url>
  16. </repository>
  17. <repository>
  18. <id>mine-meteorite-bi-release</id>
  19. <name>pub
elasticsearch 全文检索 中文分词    2017-07-19 20:36:23    794
最近用到elasticsearch做全文检索知识库系统,系统已经大致开发完成,需要中文分词,故网上搜索了下配置方法,可尝试几个都不可用,然后就看IK的git源码中有介绍,试了下,相比其他方法简单很多,也有效,故记录下,以供大家参考

参考文章:
    http://blog.csdn.net/liuzhenfeng/article/details/39404435
    https://github.com/medcl/elasticsearch-analysis-ik

Versions

IK versionES version
master2.3.1 -> master
1.9.32.3.3
1.9.02.3.0
1.8.12.2.1
1.7.02.1.1
1.5.02.0.0
1.2.61.0.0
1.2.50.90.x
1.1.30.20.x
1.0.00.16.2 -> 0.19.0

由于版本限制,并且我这里使用的是elascic 2.3.3,所以需要使用IK 1.9.3
1、下载源码:
    https://github.com/medcl/elasticsearch-analysis-ik.git
    tag:v1.9.3

2、构建 ik

修改pom.xml中repositories的配置(原有地址太慢,不确定是否可以,所以切换到自己的仓库中)
<repository>
            <id>mine</id>
            <name>public Releases</name>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mine-meteorite-bi-release</id>
            <name>public Releases</name>
            <layout>default</layout>
35/48