Elasticsearch 中 GET movie_index/_mapping 和 GET movie_index/ 的区别
在 Elasticsearch 中,GET movie_index/_mapping 和 GET movie_index/ 是两个不同的 API 请求。\n\nGET movie_index/_mapping 请求用于获取指定索引的映射信息。它将返回一个 JSON 格式的响应,其中包含了索引的字段映射信息,包括字段名称、数据类型、分词器等。\n\n例如,GET movie_index/_mapping 可以返回以下响应:\n\njson\n{\n "movie_index" : {\n "mappings" : {\n "properties" : {\n "title" : {\n "type" : "text",\n "fields" : {\n "keyword" : {\n "type" : "keyword",\n "ignore_above" : 256\n }\n }\n },\n "genre" : {\n "type" : "keyword"\n },\n "year" : {\n "type" : "integer"\n }\n }\n }\n }\n}\n\n\n而 GET movie_index/ 请求用于获取指定索引的文档数据。它将返回一个 JSON 格式的响应,其中包含了索引中的文档数据。\n\n例如,GET movie_index/ 可以返回以下响应:\n\njson\n{\n "took" : 4,\n "timed_out" : false,\n "_shards" : {\n "total" : 1,\n "successful" : 1,\n "skipped" : 0,\n "failed" : 0\n },\n "hits" : {\n "total" : {\n "value" : 2,\n "relation" : "eq"\n },\n "max_score" : 1.0,\n "hits" : [\n {\n "_index" : "movie_index",\n "_type" : "_doc",\n "_id" : "1",\n "_score" : 1.0,\n "_source" : {\n "title" : "The Shawshank Redemption",\n "genre" : "Drama",\n "year" : 1994\n }\n },\n {\n "_index" : "movie_index",\n "_type" : "_doc",\n "_id" : "2",\n "_score" : 1.0,\n "_source" : {\n "title" : "The Godfather",\n "genre" : "Crime",\n "year" : 1972\n }\n }\n ]\n }\n}\n\n\n因此,GET movie_index/_mapping 用于获取索引的映射信息,而 GET movie_index/ 用于获取索引的文档数据。两者的差距在于返回的数据内容不同。
原文地址: https://www.cveoy.top/t/topic/pWQn 著作权归作者所有。请勿转载和采集!