All Projects → ameizi → Elasticsearch Jest Example

ameizi / Elasticsearch Jest Example

Licence: mit
ElasticSearch Java Rest Client Examples

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Elasticsearch Jest Example

Elasticsearch
Elasticsearch module based on the official elasticsearch package 🌿
Stars: ✭ 176 (-6.88%)
Mutual labels:  elasticsearch
Nestjs Template
Scaffold quickly your next TypeScript API with this opinionated NestJS template crafted for Docker environments
Stars: ✭ 183 (-3.17%)
Mutual labels:  jest
Mahuta
IPFS Storage service with search capability
Stars: ✭ 185 (-2.12%)
Mutual labels:  elasticsearch
Redux Actions Assertions
Simplify testing of redux action and async action creators
Stars: ✭ 177 (-6.35%)
Mutual labels:  jest
Search Server
⭐️ Our core search API repository
Stars: ✭ 181 (-4.23%)
Mutual labels:  elasticsearch
Mage2vuestorefront
Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront
Stars: ✭ 183 (-3.17%)
Mutual labels:  elasticsearch
Xsql
Unified SQL Analytics Engine Based on SparkSQL
Stars: ✭ 176 (-6.88%)
Mutual labels:  elasticsearch
Blog Service
blog service @nestjs
Stars: ✭ 188 (-0.53%)
Mutual labels:  jest
Mozdef
DEPRECATED - MozDef: Mozilla Enterprise Defense Platform
Stars: ✭ 2,164 (+1044.97%)
Mutual labels:  elasticsearch
Wazuh
Wazuh - The Open Source Security Platform
Stars: ✭ 3,154 (+1568.78%)
Mutual labels:  elasticsearch
Vscode Jest
The optimal flow for Jest based testing in VS Code
Stars: ✭ 2,357 (+1147.09%)
Mutual labels:  jest
Inshop Crm Api
Inshop CRM / ERP API. It's powerful framework allows to build systems for business with different workflows. It has on board multi language support, clients management, projects & tasks, documents, simple accounting, inventory management, orders & invoice management, possibilities to integrate with third party software, REST API, and many other features.
Stars: ✭ 178 (-5.82%)
Mutual labels:  elasticsearch
Emoji Search
😄 Emoji synonyms to build your own emoji-capable search engine (elasticsearch, solr)
Stars: ✭ 184 (-2.65%)
Mutual labels:  elasticsearch
Storybook Addon Jest
REPO/PACKAGE MOVED - React storybook addon that show component jest report
Stars: ✭ 177 (-6.35%)
Mutual labels:  jest
Mongo Es
A MongoDB to Elasticsearch connector
Stars: ✭ 185 (-2.12%)
Mutual labels:  elasticsearch
Es Mode
An Emacs major mode for interacting with Elasticsearch
Stars: ✭ 176 (-6.88%)
Mutual labels:  elasticsearch
Elasticsearch Full
full-scale introduce for elasticsearch
Stars: ✭ 182 (-3.7%)
Mutual labels:  elasticsearch
Awesome Es
简书的优秀资源可以向专题“elasticsearch”投稿,简书外的资源欢迎向本awesome pull requests
Stars: ✭ 188 (-0.53%)
Mutual labels:  elasticsearch
Elastiflow
Network flow analytics (Netflow, sFlow and IPFIX) with the Elastic Stack
Stars: ✭ 2,322 (+1128.57%)
Mutual labels:  elasticsearch
Prometheus Es Exporter
Prometheus Elasticsearch Exporter
Stars: ✭ 184 (-2.65%)
Mutual labels:  elasticsearch

jest

ElasticSearch Java Rest Client Examples

高亮查询(highlight)

POST http://127.0.0.1:9200/news/_search?q=李克强
{
    "query" : {
        match_all:{}
    },
    "highlight" : {
        "pre_tags" : ["<font color='red'>", "<b>", "<em>"],
        "post_tags" : ["</font>", "<b>", "</em>"],
        "fields" : [
            {"title" : {}},
            {"content" : {
                "fragment_size" : 350,
                "number_of_fragments" : 3,
                "no_match_size": 150
            }}
        ]
    }
}
POST http://127.0.0.1:9200/news/_search?q=李克强
{
    "query" : {
        match_all:{}
    },
    "highlight" : {
        "pre_tags" : ["<font color='red'><b><em>"],
        "post_tags" : ["</font><b></em>"],
        "fields" : [
            {"title" : {}},
            {"content" : {
                "fragment_size" : 350,
                "number_of_fragments" : 3,
                "no_match_size": 150
            }}
        ]
    }
}

删除索引

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

DELETE http://127.0.0.1:9200/news

创建索引

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

PUT http://127.0.0.1:9200/news

创建或修改mapping

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html

PUT /{index}/_mapping/{type}
PUT http://127.0.0.1:9200/news/_mapping/article
{
  "article": {
    "properties": {
      "pubdate": {
        "type": "date",
        "format": "dateOptionalTime"
      },
      "author": {
        "type": "string"
      },
      "content": {
        "type": "string"
      },
      "id": {
        "type": "long"
      },
      "source": {
        "type": "string"
      },
      "title": {
        "type": "string"
      },
      "url": {
        "type": "string"
      }
    }
  }
}

查看mapping

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html

GET http://127.0.0.1:9200/_all/_mapping

GET http://127.0.0.1:9200/_mapping
GET http://127.0.0.1:9200/news/_mapping/article

输出:

{
  "news": {
    "mappings": {
      "article": {
        "properties": {
          "author": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "id": {
            "type": "long"
          },
          "pubdate": {
            "type": "date",
            "store": true,
            "format": "yyyy-MM-dd HH:mm:ss"
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      }
    }
  }
}

删除mapping

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-mapping.html

[DELETE] /{index}/{type}

[DELETE] /{index}/{type}/_mapping

[DELETE] /{index}/_mapping/{type}
DELETE http://127.0.0.1:9200/news/_mapping/article

ansj分词器测试

http://127.0.0.1:9200/news/_analyze?analyzer=ansj_index&text=习近平

http://127.0.0.1:9200/news/_analyze?analyzer=ansj_index&text=我是中国人

http://127.0.0.1:9200/news/_analyze?analyzer=ansj_index&text=汪东兴同志遗体在京火化汪东兴同志病重期间和逝世后,习近平李克强张德江俞正声刘云山王岐山张高丽江泽民胡锦涛等同志,前往医院看望或通过各种形式对汪东兴同志逝世表示沉痛哀悼并向其亲属表示深切慰问新华社北京8月27日电中国共产党的优秀党员

ansj分词器查询

  • 普通查询

http://127.0.0.1:9200/news/_search?q=习近平&analyzer=ansj_index&size=50

  • 指定term查询

http://127.0.0.1:9200/news/_search?q=content:江泽民&analyzer=ansj_index&size=50

http://127.0.0.1:9200/news/_search?q=title:江泽民&analyzer=ansj_index&size=50

http://127.0.0.1:9200/news/_search?q=source:新华网&analyzer=ansj_index&size=50

  • 其中ansj_index为在elasticsearch.yml文件中配置的ansj分词器

elasticsearch rest api 快速上手

elasticsearch-jdbc

@echo off

set DIR=%~dp0
set LIB="%DIR%\..\lib\*"
set BIN="%DIR%\..\bin\*"

REM ???
echo {^
    "type" : "jdbc",^
    "jdbc" : {^
        "url" : "jdbc:mysql://localhost:3306/news",^
        "user" : "root",^
        "password" : "root",^
        "schedule" : "0 0/15 * ? * *",^
        "sql" :  [^
             {"statement":"SELECT title,content,url,source,author,pubdate FROM news"},^
             {^
                "statement":"SELECT title,content,url,source,author,pubdate FROM news where pubdate > ?",^
                "parameter" : [ "$metrics.lastexecutionstart" ]^
             }^
	],^
	"autocommit" : true,^
        "treat_binary_as_string" : true,^
        "elasticsearch" : {^
             "cluster" : "elasticsearch",^
             "host" : "localhost",^
             "port" : 9300^
        },^
        "index" : "news",^
        "type" : "article"^
      }^
}^ | "%JAVA_HOME%\bin\java" -cp "%LIB%" -Dlog4j.configurationFile="file://%DIR%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"

elasticsearch-jdbc 插件的使用

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].