ragflow的ES文档信息描述

本地部署后访问地址

 http://localhost:1200/ragflow_798de0090fb211f0beb2010101010000/_search

 

解释每个字段啥意思:

 

Took

表示查询ES所花费的时间毫秒

Timed_out

是否查询超时  可以设置False

_shards.total

总共分片数

_shards.successful

成功执行的分片数

_shards.skipped

跳过的分片数

_shards.failed

失败的分片数

Hits.total

表示总共有多少条匹配的文档

Hits.value

总的匹配数值

Hits.Relation

表示分页关系例如 eq表示完全匹配

max_score

表示查询最高得分,通常用于排序查询,

Hits查询结果的数组

如下 Hits[0] 

Hits._index

表示文档所在索引名称

Hits._id

表示文档唯一标识符

Hits._score

表示文档匹配得分,值为1表示该文档与查询完全匹配

Hits._source

表示文档源数据

Hits.doc_id

文档特定id,应该是文档id

Hits.kb_id

知识库id

Hits.doc_kwd

表示文档的关键字或相关标记

Hits.title_tks

文档标题内容或处理过的标题,”测试 文件 修订”,是该文档标题字段

Hits.content_with_weight

文档内容部分,可能包含HTML或其他格式化信息

Hits.content_sn_tks

分析后的内容

Hits.timestamp

文档的时间戳

 

案例2

 

 

ES存储的文档内容

 

 

 

解释每个字段啥意思:

 

Took

表示查询ES所花费的时间毫秒

Timed_out

是否查询超时  可以设置False

_shards.total

总共分片数

_shards.successful

成功执行的分片数

_shards.skipped

跳过的分片数

_shards.failed

失败的分片数

Hits.total

表示总共有多少条匹配的文档

Hits.value

总的匹配数值

Hits.Relation

表示分页关系例如 eq表示完全匹配

Hits.max_score

表示查询最高得分,通常用于排序查询,

Hits.Hits查询结果的数组

 

Hits.Hits[0]._index

表示文档所在索引名称

Hits.Hits[0]._id

表示文档唯一标识符

Hits.Hits[0]._score

表示文档匹配得分,值为1表示该文档与查询完全匹配

Hits.Hits[0]._source

表示文档源数据

Hits.Hits[0].doc_id

文档特定id,应该是文档id

Hits.Hits[0].kb_id

知识库id

Hits.Hits[0].docnm_kwd

文档名称关键词

Hits.Hits[0].title_sm_tks

标题短语分词结果

Hits.Hits[0].title_tks

文档标题内容或处理过的标题分词结果,”测试 文件 修订”,是该文档标题字段

Hits.Hits[0].content_with_weight

文档内容部分,可能包含HTML或其他格式化信息

Hits.Hits[0].content_ltk

内容的长文本关键词

Hits.Hist[0].content_sm_ltk

内容的短文本关键词

Hits.Hits[0].content_sn_tks

分析后的内容

Hits.Hits[0].timestamp

文档的时间戳

Hits.Hits[0].create_time

创建时间

Hits.Hits[0].img_id

图像id

Hits.Hits[0].important_kwd

重要的关键词

Hits.Hits[0].important_tks

重要的分词结果

Hits.Hits[0].question_kwd

问题关键词

Hite.Hits[0].question_tks

问题的分词结果

 

 

 

ES查询

 

查看文档总数

http://localhost:1200/_count

返回结果

{

  "count": 4064,

  "_shards": {

    "total": 16,

    "successful": 16,

    "skipped": 0,

    "failed": 0

  }

}

 

查询所有索引的文档总数

http://localhost:1200/_cat/indices?h=index,docs.count

返回结果

索引名称(ragflow_用户id)              文档数量(我只看到块数量)

ragflow_f666bd640de011f093ca010101010000    8

ragflow_919dbff108c611f09507e8b0c5bc3b1d   23

ragflow_798de0090fb211f0beb2010101010000   10

ragflow_da7918980fa311f09d91010101010000 1010

ragflow_86b6c8ba0f9d11f0aced010101010000   11

ragflow_4d5f61aa0ea011f08b08010101010000  921

ragflow_7032d84a0ab211f0b720e8b0c5bc3b1d 2013

ragflow_f42dd5100ab511f085a0e8b0c5bc3b1d   10

 

查询某个索引下的文档列表  默认只显示10条数据

参数

http://localhost:1200/索引/_search?pretty

案例:

http://localhost:1200/ragflow_f666bd640de011f093ca010101010000/_search?pretty

 

 

 

分页查询某个索引下的文档列表  

参数 from第几页,size当前页显示多少条

http://localhost:1200/索引/_search?pretty&from=50&size=50

示例:

http://localhost:1200/ragflow_7032d84a0ab211f0b720e8b0c5bc3b1d/_search?pretty&from=50&size=50

 

 

  

POST /_analyze
{
  "analyzer":"standard",
  "text":"黑马程序员学习java太棒了"
  
}

POST /_analyze
{
  "analyzer":"ik_smart",
  "text":"黑马程序员学习java太棒了"
}
POST /_analyze
{
  "analyzer":"ik_max_word",
  "text":"黑马程序员学习java太棒了"
}
POST /_analyze
{
  "analyzer":"smartcn",
  "text":"黑马程序员学习java太棒了"
}


PUT /my_tables
{
  "mappings": {
    "properties": {
      "html_text": {
        "type":           "text",
        "store":           true,
        "analyzer":       "smartcn",        
        "search_analyzer":"smartcn"         
      },
      "content.as_you_type": {
        "type": "search_as_you_type"          
      },
      "html":   { "type": "keyword" } 
    }
  }
}
#查询索引内容  
POST table_index_bak_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search

GET table_index_bak_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "size": 1,
  "query": {
    "match_phrase": {
      "full_text": {
        "query": "税种 计税依据 税率",
        "slop": 100
      }
    }
  }
}
GET table_index_bak_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "size": 1,
  "query": {
    "match_phrase": {
      "full_text": {
        "query": "税种 计税依据 税率 按税法规定计算的销售货物和应税劳务收入 增值税",
        "slop": 100
      }
    }
  }
}

POST table_index_bak_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "query": {
    "bool": {
      "should": [
        { "match": { "full_text": "税种" } },
        { "match": { "full_text": "计税依据" } },
        { "match": { "full_text": "税率" } },
        { "match": { "full_text": "销售货物和应税劳务收入" } },
        { "match": { "full_text": "增值税" } }
      ],
      "minimum_should_match": 4   
    }
  }
}

#minimum_should_match 满足多少个 
POST table_index_bak_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "query": {
    "bool": {
      "should": [
        { "match": { "full_text": "公司的中文名称" } },
        { "match": { "full_text": "东软集团股份有限公司" } },
        { "match": { "full_text": "公司的中文简称" } },
        { "match": { "full_text": "东软集团" } },
        { "match": { "full_text": "公司的外文名称" } },
        { "match": { "full_text": "Neusoft" } },
        { "match": { "full_text": "Corporation" } },
        { "match": { "full_text": "公司的外文名称缩写" } },
        { "match": { "full_text": "Neusoft" } },
        { "match": { "full_text": "公司的法定代表人" } },
        { "match": { "full_text": "刘积仁" } }
      ],
      "minimum_should_match": 6
    }
  }
}







#source_id 文档docid 
#kb_id知识库id 
POST ragflow_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "query": {
    "bool": {
      "should": [
        { "match": { "source_id": "292a59702c8111f0ad28e8b0c5bc3b20" } },
        { "match": { "kb_id": "0aad07852c8111f0a530e8b0c5bc3b20" } }
       
      ],
      "minimum_should_match": 1
    }
  }
}
 

#每个es小文档id
POST ragflow_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "query": {
    "ids": {
      "values": ["08d05d224cd8fcbd"]
    }
  }
}

 

  

 

 

 

 查看某个索引有哪些字段

GET ragflow_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_mapping
 多个字段一起查询
#ids 每个es小文档id
# must 复合查询 类似于and
# terms 精准匹配页码9  page_num_int
POST ragflow_8a0e17ac2c8011f0a0e7e8b0c5bc3b20/_search
{
  "query": {
    "bool":{
    "must": [
      {"ids": {"values": ["08d05d224cd8fcbd"]}},
      {"terms": {"page_num_int": [9]}}
      ]
    }
  }
}

 

 

 

 

posted @ 2025-04-03 11:34  郎小乐  阅读(69)  评论(0)    收藏  举报