首页 > 代码库 > 创建索引并进行查询

创建索引并进行查询

curl -XPUT http://localhost:9200/suoyin1curl -XPOST http://localhost:9200/suoyin1/fulltext/_mapping -d{    "fulltext": {             "_all": {            "analyzer": "ik_max_word",            "search_analyzer": "ik_max_word",            "term_vector": "no",            "store": "false"        },        "properties": {            "content": {                "type": "text",                "analyzer": "ik_max_word",                "search_analyzer": "ik_max_word",                "include_in_all": "true",                "boost": 8            }        }    }}curl -XPOST http://localhost:9200/suoyin1/fulltext/1 -d{    "first_name" : "John1",    "last_name" :  "Smith1",    "age" :        251,    "about" :      "I love to go rock climbing1",    "interests": [ "sports", "music1" ]}curl -XPOST http://localhost:9200/suoyin1/fulltext/2 -d{    "first_name" :  "Jane1",    "last_name" :   "Smith1",    "age" :         321,    "about" :       "I like to collect rock albums1",    "interests":  [ "music1" ]}curl -XPOST http://localhost:9200/suoyin1/fulltext/3 -d{    "first_name" :  "Douglas1",    "last_name" :   "Fir1",    "age" :         351,    "about":        "I like to build cabinets1",    "interests":  [ "forestry1" ]}curl -XPOST http://localhost:9200/suoyin/fulltext/_search  -d{  "query": {    "match": {      "last_name": "smith"    }  }}dsl 语句查询http://localhost:9200/suoyin/fulltext/{    "query" : {        "match" : {            "last_name" : "Smith"        }    }}

 

 

suoyin1:索引名称,相当于数据库
fulltext:文档的类型

1,2,3:员工的ID
 

 

创建索引并进行查询