想要找个网站做环评公示怎么用视频做网站首页
web/
2025/9/29 19:04:15/
文章来源:
想要找个网站做环评公示,怎么用视频做网站首页,网站开发实战项目,设置网站首页目录 一、rest api
1. 新建索引
2. 删除索引
3. 插入单条数据
4. 更新单条数据
5. 删除单条数据
6. 查询数据
二、python elasticsearch库
1. 新建索引 一、rest api
1. 新建索引
请求方式#xff1a;PUT
请求URL#xff1a;http://ip/#xff08;your_index_nam…目录 一、rest api
1. 新建索引
2. 删除索引
3. 插入单条数据
4. 更新单条数据
5. 删除单条数据
6. 查询数据
二、python elasticsearch库
1. 新建索引 一、rest api
1. 新建索引
请求方式PUT
请求URLhttp://ip/your_index_name
示例URLhttp://ip/test_log_20240710-0 数据参数
params {settings: {number_of_shards: 1,number_of_replicas: 0},aliases: {test_log:{}},mappings: {properties: {create_time: {type: date},status:{type: integer},dev_ip:{type: ip},dev_uuid:{type: keyword},user: {properties: {name: {type: text},age: {type: integer},email: {type: keyword}}},infos: {type: nested,dynamic: false,properties: {v_id: {type: keyword},v_name: {type: keyword},v_desc: {type: text}}},remark: {type: text},show_num: {type: long, doc_values: false, index: false}}}
}
字段类型text用于全文本搜索如文章内容。text字段会被分析器分词支持模糊搜索和前缀搜索。
keyword用于不进行分词的搜索适合存储关键词、ID、标签等。keyword字段不会被分词适用于精确匹配和聚合。
integer/long/short/byte/double/float/half_float/scaled_float用于数值类型的数据不同的类型对应不同的数值范围和精度。
boolean布尔型字段值只能是true或false。
binary用于存储二进制数据如图像或文件。
date日期时间字段可以使用ISO8601格式的字符串或毫秒级的时间戳。
date_nanos纳秒精度的日期时间字段存储为纳秒时间戳。
ip用于存储IPv4或IPv6地址。
object用于嵌套的JSON对象。可以定义内部字段的映射。
nested用于存储复杂结构的嵌套文档允许对嵌套文档进行独立索引和搜索。
geo_point用于地理坐标支持基于地理位置的查询。
geo_shape用于地理形状如多边形支持更复杂的地理查询。
completion用于自动补全功能存储经过分析的词条列表。
constant_keyword与keyword类似但值在索引时会被复制到所有分片加速聚合操作。
token_count用于存储分词后的词数。2. 删除索引
请求方式DELETE
请求URLhttp://ip/your_index_name
示例URLhttp://ip/test_log_20240710-0
3. 插入单条数据
请求方式POST
请求URLhttp://ip/your_index_name
示例URLhttp://ip/test_log_20240710-0
数据参数
{create_time: 1720601022255,status: 201,dev_ip: 192.168.1.101,dev_uuid: 123e4567e89b12d3a456426614174000,user: {name: 战三,age: 30,email: zhansanexample.com},infos: [{v_id: 123e4567e89b12d3a456426614174000,v_name: 战三,v_desc: 描述啦啦啦啦啦啦}],remark: 描述,show_num: 6789
}
4. 更新单条数据
请求方式PUT
请求URLhttp://ip/your_index_name/_doc/本条记录id
示例URLhttp://ip/test_log_20240710-0/_doc/KjjOm5ABJ5wlHmqgfJvm
数据参数
{create_time: 2023-04-01T12:00:00Z,status: 200,dev_ip: 192.168.1.100,dev_uuid: 123e4567-e89b-12d3-a456-426614174000,user: {name: 阿汉,age: 30,email: john.doeexample.com},infos: [{v_id: info1,v_name: Info One,v_desc: This is the description of info one.},{v_id: info2,v_name: Info Two,v_desc: This is the description of info two.}],remark: Additional remarks about this log entry.,show_num: 12345
}
5. 删除单条数据
请求方式DELETE
请求URLhttp://ip/your_index_name/_doc/本条记录id
示例URLhttp://ip/test_log_20240710-0/_doc/KjjOm5ABJ5wlHmqgfJvm
数据参数无
6. 查询数据
请求方式POST
请求URLhttp://ip/your_index_name/_search
示例URLhttp://ip/test_log_20240710-0/_search
数据参数
{size: 10,query: {bool: {must: [{term: {status: 200}}]}}
}
二、python elasticsearch库
1. 新建索引
......
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/84052.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!