taesu
taesu

Reputation: 4580

What is the significance of type in elastic search?

So I wish to dump my rdb to elasticsearch to utilize search capabilities.
Below example snippet shows how to index an item with attributes.
I am envisioning there will be close to 1m records eventually.

$params = array();
$params['body']  = array(
  'name' => 'Ash Ketchum',
  'age' => 10,
  'badges' => 8 
);

$params['index'] = 'pokemon';
$params['type']  = 'pokemon_trainer';

$result = $client->index($params);

I have a few questions here.

  1. is index eqv to database in rdb?
  2. is type eqv of table in rdb?
  3. I will be fuzzy searching body->name field, is this the correct implementation?

Upvotes: 0

Views: 44

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

is index eqv to database in rdb?

It can be or not. Usually, I don't recommend mirroring a DB database with an index. Elasticsearch usually likes de-normalized data ;-), rather than the usual relational DB with inner keys.

is type eqv of table in rdb?

NO. The type is a convenient way to do field filters. The _type itself is just a field in the index.

I will be fuzzy searching body->name field, is this the correct implementation?

I don't know what you mean by that, but yes you can search on fields. I suggest first going over ES documentation (it helps a lot) and then look at the php one.

Upvotes: 1

Related Questions