首页 > 代码库 > 创建索引并进行查询
创建索引并进行查询
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
创建索引并进行查询
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。