postman 测试elasticsearch 导出json

{
    "info": {
        "_postman_id": "9b2a03a6-d61d-4819-bdf8-1f0a5b2e7b00",
        "name": "es",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
        {
            "name": "indexsearch",
            "request": {
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "urlencoded",
                    "urlencoded": []
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "ik_max_word",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "auth": {
                    "type": "basic",
                    "basic": [
                        {
                            "key": "password",
                            "value": "123456",
                            "type": "string"
                        },
                        {
                            "key": "username",
                            "value": "elastic",
                            "type": "string"
                        }
                    ]
                },
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
 "analyzer":"ik_max_word",
 "text":"中华人民共和国国歌"
}
",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_analyze",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_analyze"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "ik_smart",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
 "analyzer":"ik_smart",
 "text":"中华人民共和国国歌"
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_analyze",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_analyze"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "queryindex",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "http://192.168.8.202:9200/test-2",
            "request": {
                "method": "DELETE",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建索引",
            "request": {
                "auth": {
                    "type": "basic",
                    "basic": [
                        {
                            "key": "password",
                            "value": "123456",
                            "type": "string"
                        },
                        {
                            "key": "username",
                            "value": "elastic",
                            "type": "string"
                        }
                    ]
                },
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
	"settings":{
		"number_of_shards": "5",
		"number_of_replicas": "1"
	},
	"mappings": {
		"stream_line":{
			"properties":{
				"stream_line_id":{
					"type":"keyword",
					"index": "not_analyzed",
					"store": true
				},
				"name":{
					"type":"string",
					"index": "ik_smart",
					"store": true
				},
				"area_id":{
					"index": "ik_smart",
					"type":"text",
					"store": true
				},
				"spec_id":{
					"index": "not_analyzed",
					"type":"string",
					"store": true
				},
				"vpl_id":{
					"index": "not_analyzed",
					"type":"text",
					"store": true
				},
				"status":{
					"index": "not_analyzed",
					"type":"integer",
					"store": true
				},
				"start_time":{
					"type":"date",
					"format":"yyyy-MM-dd HH-mm-ss||yyyy-MM-dd||epoch_millis",
					"index": "not_analyzed",
					"store": true
				},
				"end_time":{
					"type":"date",
					"format":"yyyy-MM-dd HH-mm-ss||yyyy-MM-dd||epoch_millis",
					"index": "not_analyzed",
					"store": true
				}
			}
		}
    }
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/commodity2",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "commodity2"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建索引映射",
            "request": {
                "auth": {
                    "type": "basic",
                    "basic": [
                        {
                            "key": "password",
                            "value": "123456",
                            "type": "string"
                        },
                        {
                            "key": "username",
                            "value": "elastic",
                            "type": "string"
                        }
                    ]
                },
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
    "mappings" : {
            "properties":{
                "id":{
                    "type":"text"
                },
                "name":{
                    "type":"text",
                     "analyzer": "ik_max_word",
                     "search_analyzer": "ik_max_word"
                    
                },
                "content":{
                    "type":"text",
                     "analyzer": "ik_max_word",
                     "search_analyzer": "ik_max_word"
                },
                "createdate":{
                    "type":"date"
                }
            }
    }
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询所有动态模板",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_template",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_template"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询某个模板",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_template/test_template_default",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_template",
                        "test_template_default"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询映射",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_mapping?pretty",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_mapping"
                    ],
                    "query": [
                        {
                            "key": "pretty",
                            "value": null
                        }
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建索引模板",
            "request": {
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
  "index_patterns":[
    "template-*"
  ],
  "settings":{
    "number_of_replicas":1,
    "refresh_interval":"10s",
    "index.search.slowlog.threshold.query.warn": "10s",
    "index.search.slowlog.threshold.query.info": "5s",
    "index.search.slowlog.threshold.query.debug": "2s",
    "index.search.slowlog.threshold.query.trace": "500ms"
  },
  "mappings": {
    "properties": {        
      "@timestamp": {   
          "type": "date",           
          "format": "yyyy-MM-dd HH:mm:ss"
      },
      "@version": {
          "index": "false",   
          "type": "text"      
      },
      "logLevel": {
          "type": "long"
      }
    }
  },
  "order":0
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_template/test_template_default",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_template",
                        "test_template_default"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建索引模板",
            "request": {
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
  "index_patterns":[
    "template-test*"
  ],
  "settings":{
    "number_of_replicas":1,
    "number_of_shards":3,
    "refresh_interval":"20s",
    "index.search.slowlog.threshold.query.warn": "10s",
    "index.search.slowlog.threshold.query.info": "5s",
    "index.search.slowlog.threshold.query.debug": "2s",
    "index.search.slowlog.threshold.query.trace": "500ms"
  },
  "mappings": {
    "date_detection": false, 
    "properties": {
      "@version": {
          "type": "keyword"      
      },
      "logLevel": {
          "type": "long"
      }
    }
  },
  "order":1
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_template/test_template_demo",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_template",
                        "test_template_demo"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "_index_template创建demo1",
            "request": {
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
  "index_patterns" : ["te*"],
  "priority" : 1,
  "template": {
    "settings" : {
      "number_of_shards" : 2
    }
  }
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template/template_1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template",
                        "template_1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "删除模板",
            "request": {
                "method": "DELETE",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_template/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_template",
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "获取所有索引模板",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询某个索引模板信息",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template",
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "索引模板是否存在",
            "request": {
                "method": "HEAD",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template/test-1
",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template",
                        "test-1
"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "删除索引模板",
            "request": {
                "method": "DELETE",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template",
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建或更新 索引模板",
            "request": {
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
	"index_patterns": [
		"test-1"
	],
	"template": {
		"settings": {
			"number_of_shards": 1,
			"number_of_replicas": 0
		},
		"mappings": {
			"properties": {
				"id": {
					"type": "keyword",
					"store": "true",
					"index": true
				},
				"name": {
					"type": "text",
					"analyzer": "ik_max_word",
					"search_analyzer": "ik_smart",
					"store": "true",
					"index": true
				},
				"content": {
					"type": "text",
					"analyzer": "ik_max_word",
					"search_analyzer": "ik_smart",
					"store": "true",
					"index": true
				},
				"createdate": {
					"type": "keyword",
					"store": "true",
					"index": true
				}
			}
		}
	},
	"priority": 10,
	"version": 10,
	"_meta": {
		"description": "于吉利创建",
		"createtime": "2021-09-10",
		"function": "模板功能测试"
	}
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/_index_template/test-1",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_index_template",
                        "test-1"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询文档",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "多字段匹配查询",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
  "query": {
    "multi_match": {
      "query": "开发",
      "fields": ["name","content"]
    }
  }

}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "精准查询(短语搜索)",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{
  "query": {
    "match_phrase": {
      "name": "开发"
    }
  }
}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询文档_doc",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_doc/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_doc",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询文档 q=",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/test-1/_doc/_search?q=name:开发",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "test-1",
                        "_doc",
                        "_search"
                    ],
                    "query": [
                        {
                            "key": "q",
                            "value": "name:开发"
                        }
                    ]
                }
            },
            "response": []
        },
        {
            "name": "查询所有文档",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "http://192.168.8.202:9200/_search",
                    "protocol": "http",
                    "host": [
                        "192",
                        "168",
                        "8",
                        "202"
                    ],
                    "port": "9200",
                    "path": [
                        "_search"
                    ]
                }
            },
            "response": []
        }
    ],
    "auth": {
        "type": "basic",
        "basic": [
            {
                "key": "password",
                "value": "123456",
                "type": "string"
            },
            {
                "key": "username",
                "value": "elastic",
                "type": "string"
            }
        ]
    },
    "event": [
        {
            "listen": "prerequest",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        },
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        }
    ]
}
原文地址:https://www.cnblogs.com/Jeely/p/15266337.html