CC00021.elasticsearch——|Hadoop&ElasticSearch.V21|——|ELK.v21|集群|QueryDSL|词条级搜索.V1|
时间:2023-08-29 06:37:00
### --- 词条级搜索 ~~~ 可以使用term-level queries根据结构化数据中的精确值找到文档。 ~~~ 结构化数据的值包括日期范围,IP地址、价格或产品ID。 ~~~ 不同于全文查询,term-level queries不分析搜索词。 ~~~ 相反,条目与存储在字段级别中的术语完全匹配。
### --- 词条级搜索示例 PUT /book { "settings": {}, "mappings" : { "properties" : { "description" : { "type" : "text", "analyzer" : "ik_max_word" }, "name" : { "type" : "text", "analyzer" : "ik_max_word" }, "price" : { "type" : "float" }, "timestamp" : { "type" : "date", "format" : "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" } } } }

PUT /book/_doc/1 { "name": "lucene", "description": "Lucene Core is a Java library providing powerful indexing and search features, as well as spellchecking, hit highlighting and advanced analysis/tokenization capabilities. The PyLucene sub project provides Python bindings for Lucene Core. ", "price":100.45, "timestamp":"2021-11-21 19:11:35" }
PUT /book/_doc/2 { "name": "solr", "description": "Solr is highly scalable, providing fully fault tolerant distributed indexing, search and analytics. It exposes Lucenes features through easy to use JSON/HTTP interfaces or native clients for Java and other languages.", "price":320.45, "timestamp":"2021-11-21 17:11:35" }
PUT /book/_doc/3 { "name": "Hadoop", "description": "The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models.", "price":620.45, "timestamp":"2021-11-22 19:18:35" }
PUT /book/_doc/4 { "name": "ElasticSearch", "description": "Elasticsearch是一个基于Lucene搜索服务器。基于分布式多用户能力的全文搜索引擎RESTful web接口。Elasticsearch是用Java并作为语言开发Apache开放源代码发布在许可条款下,是一种流行的企业级搜索引擎。Elasticsearch用于云计算,可实现实时搜索,稳定、可靠、快速、安装使用方便。官方客户端在Java、.NET(C#)、PHP、Python、Apache Groovy、Ruby它可以用于许多其他语言。根据DB-Engines排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr,也是基于Lucene。", "price":999.99, "timestamp":"2021-11-15 10:11:35" }