请大神帮解答一下`elasticsearch`的相关问题,看文档看不出个步骤来
已完成工作描述:
1、已在本地windows机器上安装好了elasticsearch及相关插件。
2、然后在laravel中安装好了elasticsearch-php客户端。
3、写了如下这么一个SearchController控制器:
<code><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class SearchController extends Controller { protected $client; public function __construct() { $this->client = \Elasticsearch\ClientBuilder::create()->build(); } public function index() { $params = [ 'index' => 'node', 'type' => 'article', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->search($params); print_r($response); } public function create() { $params = [ 'index' => 'node', 'type' => 'article', 'id' => '1029', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->index($params); print_r($response); } public function store(Request $request) { } public function show($id) { } public function edit($id) { } public function update(Request $request, $id) { } public function destroy($id) { } } </code>
问题描述:
1、虽然完成了以上3步,但现在没有头绪,看文档也看不出个步骤来。具体表现就是:假如我现在就要对一个名为articles
的数据表进行索引和查询,还需要做什么?最好说一下每一步怎么做。谢谢。
2、'index' 、 'type' 、'body'是什么含义?
3、如果不用mysql,直接使用ES保存索引,那索引文件默认在什么目录?
回复内容:
已完成工作描述:
1、已在本地windows机器上安装好了elasticsearch及相关插件。
2、然后在laravel中安装好了elasticsearch-php客户端。
3、写了如下这么一个SearchController控制器:
<code><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class SearchController extends Controller { protected $client; public function __construct() { $this->client = \Elasticsearch\ClientBuilder::create()->build(); } public function index() { $params = [ 'index' => 'node', 'type' => 'article', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->search($params); print_r($response); } public function create() { $params = [ 'index' => 'node', 'type' => 'article', 'id' => '1029', 'body' => [ 'query' => [ 'match_all' => [] ] ] ]; $response = $this->client->index($params); print_r($response); } public function store(Request $request) { } public function show($id) { } public function edit($id) { } public function update(Request $request, $id) { } public function destroy($id) { } } </code>
问题描述:
1、虽然完成了以上3步,但现在没有头绪,看文档也看不出个步骤来。具体表现就是:假如我现在就要对一个名为articles
的数据表进行索引和查询,还需要做什么?最好说一下每一步怎么做。谢谢。
2、'index' 、 'type' 、'body'是什么含义?
3、如果不用mysql,直接使用ES保存索引,那索引文件默认在什么目录?
最近也是刚接触了es
es可以对应一个mysql数据库
index的概念就相当于库
type的概念就相当于表
document就相当于记录
那么你要操作,你首先要有个库,要有个表,才能进行增删查改
怎么索引和搜索去看文档吧
索引文件以文件形式存储在ES_HOME/data
下
logstash的jdbc插件你可以去官网找,jdbc官方文档

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

CakePHP 是 PHP 的开源框架。它的目的是使应用程序的开发、部署和维护变得更加容易。 CakePHP 基于类似 MVC 的架构,功能强大且易于掌握。模型、视图和控制器 gu

登录 CakePHP 是一项非常简单的任务。您只需使用一项功能即可。您可以记录任何后台进程(如 cronjob)的错误、异常、用户活动、用户采取的操作。在 CakePHP 中记录数据很容易。提供了 log() 函数

Visual Studio Code,也称为 VS Code,是一个免费的源代码编辑器 - 或集成开发环境 (IDE) - 可用于所有主要操作系统。 VS Code 拥有针对多种编程语言的大量扩展,可以轻松编写
