-
理想的搜索:
新的数据⼀添加到索引中⽴⻢就能搜索到,但是真实情况不是这样的。
-
我们使⽤链式命令请求,先添加⼀个⽂档,再⽴刻搜索
//插入数据
curl -X PUT localhost:9200/star/_doc/888 -H 'Content-Type:application/json' -d '{ "displayName": "蔡徐坤" }'
//查询数据curl - X GET localhost : 9200 / star / _doc / _search ? pretty
结果肯定是搜索不到的。。。。。。
-
强制刷新
//插入数据,传入参数 refreshcurl - X PUT localhost : 9200 / star / _doc / 666 ? refresh - H 'Content-Type:application/json' - d '{ "displayName": " 杨超越 " }'//查询数据curl - X GET localhost : 9200 / star / _doc / _search ? pretty
-
修改默认更新时间(默认时间是1s)
PUT / star / _settings{
"index": {
"refresh_interval": "5s"
}
}
-
将refresh关闭
PUT / star / _settings{
"index": {
"refresh_interval": "-1"
}
}