ES里设置索引中倒排列表仅仅存文档ID——采用docs存储后可以降低pos文件和cfs文件大小

简介:

index_options

The index_options parameter controls what information is added to the inverted index, for search and highlighting purposes. It accepts the following settings:

docs

Only the doc number is indexed. Can answer the question Does this term exist in this field?

freqs

Doc number and term frequencies are indexed. Term frequencies are used to score repeated terms higher than single terms.

positions

Doc number, term frequencies, and term positions (or order) are indexed. Positions can be used for proximity or phrase queries.

offsets

Doc number, term frequencies, positions, and start and end character offsets (which map the term back to the original string) are indexed. Offsets are used by the postings highlighter.

Analyzed string fields use positions as the default, and all other fields use docs as the default.

PUT my_index
{
  "mappings": { "my_type": { "properties": { "text": { "type": "text", "index_options": "offsets" } } } } } PUT my_index/my_type/1 { "text": "Quick brown fox" } GET my_index/_search { "query": { "match": { "text": "brown fox" } }, "highlight": { "fields": { "text": {}  } } }

The text field will use the postings highlighter by default because offsets are indexed.

 

转自:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-options.html

 

注意:ES2.41里没有text这个type

复制代码
curl -XPUT 'http://localhost:9200/hec_test2' -d '
{
  "mappings": {
    "hec_type2": {
      "properties": {
        "filed-0": {
          "type": "string",
          "index_options": "docs"
        },
        "filed-1": {
          "type": "string",
          "index_options": "docs"
        }
      }
    }
  }
}
'
复制代码

比较测试:

可以比默认的节省10+%的存储空间!

 

 

 











本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6397522.html,如需转载请自行联系原作者


相关文章
|
10月前
|
自然语言处理 安全 Java
Spring Boot中集成Lucence
Lucene是Apache开源的全文检索库,基于Java开发,通过分词、建立索引实现高效搜索。本文详解其原理,并结合Spring Boot实现英文索引、中文分词及高亮查询,助你快速掌握全文检索技术。
|
8月前
|
存储 Java 中间件
Java 虚拟线程:JDK21 轻量级并发革命
JDK21正式引入的虚拟线程是Java并发模型的革命性升级:轻量(百字节/个)、百万级可扩展、JVM自主调度、零OS上下文切换,完美解决传统平台线程内存高、并发低、调优难痛点,尤其适用于IO密集型微服务与网关场景。
861 4
|
人工智能 Java 数据库
Spring AI
Spring AI 为 Java 生态注入智能,提供统一抽象接口,简化大模型集成,助力开发者高效构建 AI 应用,推动企业智能化转型。
1646 147
|
8月前
|
数据采集 监控 物联网
大模型微调实战——从数据准备到落地部署全流程
本文以7B大模型为例,手把手教你零代码完成办公场景微调:从数据清洗、LoRA轻量训练到效果验证与一键部署,全程无需GPU和编程基础,30分钟快速上手,解决“通用模型不精准、输出不可控”痛点,让大模型真正落地业务。
|
10月前
|
存储 缓存 Java
SpringBoot自动装配机制
本章深入解析SpringBoot自动装配机制,从@SpringBootApplication注解入手,剖析其组合注解原理。重点讲解@EnableAutoConfiguration如何通过@AutoConfigurationPackage实现包扫描、通过AutoConfigurationImportSelector加载spring.factories中的自动配置类,结合@Conditional条件注解实现智能化配置。同时解析@ComponentScan组件过滤机制及自定义排除方式,揭示SpringBoot“约定优于配置”的底层实现逻辑。(238字)
|
10月前
|
人工智能 NoSQL 前端开发
springai
SpringAI整合多款主流大模型,支持对话、函数调用与RAG等架构,提供统一API简化开发。涵盖Ollama、OpenAI等平台,实现聊天机器人、智能客服、知识库问答(如ChatPDF)及多模态交互,助力快速构建AI应用。
1700 0
|
微服务
什么是微服务?微服务的优缺点是什么?
微服务就是一个独立的职责单一的服务应用程序,一个模块 1.优点:松耦合,聚焦单一业务功能,无关开发语言,团队规模降低 , 扩展性好, 天然支持分库2.缺点:随着服务数量增加,管理复杂,部署复杂,服务器需要增多,服务通信和调用压力增大
|
测试技术
外包对职业发展是否有影响?
从事两年外包工作并不会影响未来的发展,关键在于是否在此期间提升了个人能力。许多外包人员由于缺乏系统的培训,能力停滞不前,只能从事低级的手工测试工作。在华为合作的外包人员中,部分人因公司未提供培养机会,导致技能难以提升。因此,在外包期间应主动学习,掌握自动化和编程技能,以提高竞争力。大部分企业并不在意求职者是否有外包经历,只要能力达标即可。建议不要在外包公司停留过久,及时跳槽寻找更好的发展机会,避免因长期外包而失去学习动力。
|
存储 JSON 自然语言处理
【大数据开发运维解决方案】ElasticSearc写入查询性能优化总结
ES(ElasticSearch) 我们需要根据公司要求,进行偏向性的优化。1、bulk批量写入2、多线程写入3、修改索引刷新时间4、修改merge参数以及线程数6、index buffer7、磁盘间的任务均衡8、Mapping优化8.1、自动生成docID(避免ES对自定义ID验证的操作) 8.2、调整字段Mapping 8.3、调整_source字段 8.4、禁用_all 8.5、禁用Norms 8.6、index_options设置 9、优化存储
【大数据开发运维解决方案】ElasticSearc写入查询性能优化总结

热门文章

最新文章