1.GET /index-name/_search/
{
"query": {
"bool": {
"filter": [
{
"range": {
"dt": {
"gte": "20191112",
"lte": "20191112",
"format": "yyyyMMdd",
"time_zone": "+08:00"
}
}
}
],
"must":[
{
"match_phrase":{
"user_name":""
}
}
]
}
}
}
2.GET /index-name/_search/
{"query":{"bool":{"filter":[{"term":{"feed_id":{"value":"6810658570879700237","boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}}}
2.更新字段值
1.POST /index-name/all/docId/_update
{
"doc":{
"word" : "[{‘word‘:‘笑死‘,‘count‘:‘7.0‘},{‘word‘:‘笑‘,‘count‘:‘7.0‘}]"
}
}
2.POST /index-name/all/docId/_update
{
"doc":{
"music_name" : "原声"
}
}
3.删除索引
DELETE index-name
4.通过url查询数据
http://10.2.3.101:9200/_cat/indices
http://10.2.3.101:9200/index-name/all/517588130509981824
5.设置字段类型
PUT /index-name
{
"mappings": {
"all": {
"properties": {
"feed_id": {
"type": "keyword"
},
"user_id": {
"type": "keyword"
},
"comment_feed_id": {
"type": "keyword"
},
"comment_feed_content":{
"type": "text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_max_word"
},
"create_time":{
"type": "keyword"
},
"key":{
"type": "keyword"
},
"dt":{
"type": "keyword"
}
}
}
}
}
6.更新字段类型
PUT /newbank
{
"mappings": {
"properties": {
"age": {
"type": "integer"
},
"name": {
"type": "text"
},
"mail": {
"type": "keyword"
}
}
}
}
GET /newbank/_mapping
POST _reindex
{
"source":{
"index":"bank"
},
"dest":{
"index":"newkank"
}
}
POST _reindex
{
"source":{
"index":"bank"
"type":"account"
},
"dest":{
"index":"newkank"
}
}
7.分词
按照空格将每个单词分割
POST _analyze
{
"analyzer":"standard",
"text":"The 2 quick Brown-Foxes jumped the dog‘s bone."
}
8.查看相关性评分详情
GET /index-name/all/517588130509981824/_explain
{
"query":{
"bool":{
"must":{"match":{"user_id":"517588130509981824"}}
}
}
}
原文:https://www.cnblogs.com/mn-lily/p/14628139.html