SlideShare a Scribd company logo
1 of 20
Download to read offline
ElasticSearch
Mapping and Analysis
http://elastic.openthinklabs.com/
Mapping and Analysis
GET /_search?q=2014 # 12 results
GET /_search?q=2014-09-15 # 12 results !
GET /_search?q=date:2014-09-15 # 1 result
GET /_search?q=date:2014 # 0 results !
GET /gb/_mapping/tweet
{
"gb": {
"mappings": {
"tweet": {
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"name": {
"type": "string"
},
"tweet": {
"type": "string"
},
"user_id": {
"type": "long"
}
}
}
}
}
}
Exact Values Versus Full Text
● Exact values are exactly what they sound like.
Examples are a date or a user ID, but can also include
exact strings such as a username or an email address.
The exact value Foo is not the same as the exact
value foo. The exact value 2014 is not the same as the
exact value 2014-09-15
● Full text, on the other hand, refers to textual data—
usually written in some human language — like the   
text of a tweet or the body of an email.
Inverted Index
●
For example, let’s say we have two documents, each with a content field
containing the following:
●
The quick brown fox jumped over the lazy dog
● Quick brown foxes leap over lazy dogs in summer
● Search for quick brown :
Analysis and Analyzers
● Analysis is a process that consists of the following:
● First, tokenizing a block of text into individual terms
suitable for use in an inverted index,
● Then normalizing these terms into a standard form to
improve their “searchability,” or recall
● An analyzer is really just a wrapper that combines
three functions into a single package:
● Character filters
● Tokenizer
● Token filters
Analysis and Analyzers
Built-in Analyzers
● Standard analyzer
● set, the, shape, to, semi, transparent, by, calling, set_trans, 5
● Simple analyzer
● set, the, shape, to, semi, transparent, by, calling, set, trans
● Whitespace analyzer
● Set, the, shape, to, semi-transparent, by, calling, set_trans(5)
● Language analyzers
● set, shape, semi, transpar, call, set_tran, 5
"Set the shape to semi-transparent by calling set_trans(5)"
Analysis and Analyzers
Testing Analyzers
GET /_analyze
{
"analyzer": "standard",
"text": "Text to analyze"
}
{
"tokens": [
{
"token":
"text",
"start_offset": 0,
"end_offset": 4,
"type":
"<ALPHANUM>",
"position": 1
},
{
"token": "to",
"start_offset": 5,
"end_offset": 7,
"type":
"<ALPHANUM>",
"position": 2
},
{
"token":
"analyze",
"start_offset": 8,
"end_offset": 15,
"type":
"<ALPHANUM>",
"position": 3
}
]
}
Analysis and Analyzers
Specifying Analyzers
● When Elasticsearch detects a new string field in
your documents, it automatically configures it
as a full-text string field and analyzes it with the
standard analyzer.
● We can apply a different analyzer that suits the
language your data is in, by configuring these
fields manually by specifying the mapping.
Mapping
Core Simple Field Types
● Elasticsearch supports the following simple field
types:
● String: string
● Whole number: byte, short, integer, long
● Floating-point: float, double
● Boolean: boolean
● Date: date
Mapping
Viewing The Mapping
GET /gb/_mapping/tweet {
"gb": {
"mappings": {
"tweet": {
"properties": {
"date": {
"type": "date",
"format":
"strict_date_optional_time||epoch_millis"
},
"name": {
"type": "string"
},
"tweet": {
"type": "string"
},
"user_id": {
"type": "long"
}
}
}
}
}
}
Mapping
Customizing Field Mappings
● Custom mappings allow you to do the following:
● Distinguish between full-text string fields and exact
value string fields
● Use language-specific analyzers
● Optimize a field for partial matching
● Specify custom date formats
● And much more
{
"number_of_clicks": {
"type": "integer"
}
}
Mapping
Customizing Field Mappings
● The two most important mapping attributes for string
fields are index and analyzer.
● index : The index attribute controls how the string will be
indexed. It can contain one of three values:
– analyzed : First analyze the string and then index it. In other words,
index this field as full text.
– not_analyzed : ndex this field, so it is searchable, but index the value
exactly as specified. Do not analyze it.
– No : Don’t index this field at all. This field will not be searchable.
● The default value of index for a string field is analyzed
{
"tag": {
"type": "string",
"index": "not_analyzed"
}
}
Mapping
Customizing Field Mappings
● analyzer
● For analyzed string fields, use the analyzer attribute
to specify which analyzer to apply both at search
time and at index time. By default, Elasticsearch
uses the standard analyzer, but you can change
this by specifying one of the built-in analyzers, such
as whitespace, simple, or english:
{
"tweet": {
"type": "string",
"analyzer": "english"
}
}
Mapping
Updating a Mapping
DELETE /gb
PUT /gb
{
"mappings": {
"tweet" : {
"properties" : {
"tweet" : {
"type" : "string",
"analyzer": "english"
},
"date" : {
"type" : "date"
},
"name" : {
"type" : "string"
},
"user_id" : {
"type" : "long"
}
}
}
}
}
PUT /gb/_mapping/tweet
{
"properties" : {
"tag" : {
"type" : "string",
"index": "not_analyzed"
}
}
}
GET /gb/_analyze
{
"field": "tweet",
"text": "Black-cats"
}
GET /gb/_analyze
{
"field": "tag",
"text": "Black-cats"
}
Complex Core Field Types
● Besides the simple scalar datatypes that we
have mentioned, JSON also has null values,
arrays, and objects, all of which are supported
by Elasticsearch.
{ "tag": [ "search", "nosql" ]}
Multivalue Fields
"null_value": null,
"empty_array": [],
"array_with_null_value": [ null ]
Empty Fields
Complex Core Field Types
Multilevel Objects
{
"tweet": "Elasticsearch is very flexible",
"user": {
"id": "@johnsmith",
"gender": "male",
"age": 26,
"name": {
"full": "John Smith",
"first": "John",
"last": "Smith"
}
}
}
Complex Core Field Types
Mapping for Inner Objects
{
"gb": {
"tweet": {
"properties": {
"tweet": { "type": "string" },
"user": {
"type": "object",
"properties": {
"id": { "type": "string" },
"gender": { "type": "string" },
"age": { "type": "long" },
"name": {
"type": "object",
"properties": {
"full": { "type": "string" },
"first": { "type": "string" },
"last": { "type": "string" }
}
}
}
}
}
}
}
}
Complex Core Field Types
How Inner Objects are Indexed
● Lucene doesn’t understand inner objects. A Lucene
document consists of a flat list of key-value pairs. In order
for Elasticsearch to index inner objects usefully, it converts
our document into something like this:
{
"tweet": [elasticsearch, flexible, very],
"user.id": [@johnsmith],
"user.gender": [male],
"user.age": [26],
"user.name.full": [john, smith],
"user.name.first": [john],
"user.name.last": [smith]
}
Complex Core Field Types
Arrays of Inner Objects
● Finally, consider how an array containing inner objects would be
indexed. Let’s say we have a followers array that looks like this:
{
"followers": [
{ "age": 35, "name": "Mary White"},
{ "age": 26, "name": "Alex Jones"},
{ "age": 19, "name": "Lisa Smith"}
]
}
● This document will be flattened as we described previously, but
the result will look like this:
{
"followers.age": [19, 26, 35],
"followers.name": [alex, jones, lisa, smith, mary, white]
}
Referensi
● ElasticSearch, The Definitive Guide, A Distrib
uted Real-Time Search and Analytics Engine, Cl
inton Gormely & Zachary Tong, O’Reilly

More Related Content

What's hot

Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...
Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...
Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...Markus Lanthaler
 
A Semantic Description Language for RESTful Data Services to Combat Semaphobia
A Semantic Description Language for RESTful Data Services to Combat SemaphobiaA Semantic Description Language for RESTful Data Services to Combat Semaphobia
A Semantic Description Language for RESTful Data Services to Combat SemaphobiaMarkus Lanthaler
 
Django with MongoDB using MongoEngine
Django with MongoDB using MongoEngineDjango with MongoDB using MongoEngine
Django with MongoDB using MongoEngineRakesh Kumar
 
Schema design short
Schema design shortSchema design short
Schema design shortMongoDB
 
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)MongoSF
 
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)Kai Chan
 
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Kai Chan
 
Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Kai Chan
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkMongoDB
 
Dropping ACID with MongoDB
Dropping ACID with MongoDBDropping ACID with MongoDB
Dropping ACID with MongoDBkchodorow
 
Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Linux User's Group
 
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDBMongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDBMongoDB
 
NoSQL を Ruby で実践するための n 個の方法
NoSQL を Ruby で実践するための n 個の方法NoSQL を Ruby で実践するための n 個の方法
NoSQL を Ruby で実践するための n 個の方法Tomohiro Nishimura
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_dbRomain Testard
 

What's hot (20)

Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...
Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...
Aligning Web Services with the Semantic Web to Create a Global Read-Write Gra...
 
A Semantic Description Language for RESTful Data Services to Combat Semaphobia
A Semantic Description Language for RESTful Data Services to Combat SemaphobiaA Semantic Description Language for RESTful Data Services to Combat Semaphobia
A Semantic Description Language for RESTful Data Services to Combat Semaphobia
 
Django with MongoDB using MongoEngine
Django with MongoDB using MongoEngineDjango with MongoDB using MongoEngine
Django with MongoDB using MongoEngine
 
Schema design short
Schema design shortSchema design short
Schema design short
 
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right WayMongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
MongoDB Europe 2016 - ETL for Pros – Getting Data Into MongoDB The Right Way
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)
 
Google Dorks
Google DorksGoogle Dorks
Google Dorks
 
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 1 (SoCal Code Camp LA 2013)
 
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
Search Engine-Building with Lucene and Solr, Part 2 (SoCal Code Camp LA 2013)
 
Json
JsonJson
Json
 
Mongo db
Mongo dbMongo db
Mongo db
 
Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)Java Performance Tips (So Code Camp San Diego 2014)
Java Performance Tips (So Code Camp San Diego 2014)
 
REST
RESTREST
REST
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation Framework
 
Beautiful soup
Beautiful soupBeautiful soup
Beautiful soup
 
Dropping ACID with MongoDB
Dropping ACID with MongoDBDropping ACID with MongoDB
Dropping ACID with MongoDB
 
Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)
 
MongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDBMongoDB Europe 2016 - Graph Operations with MongoDB
MongoDB Europe 2016 - Graph Operations with MongoDB
 
NoSQL を Ruby で実践するための n 個の方法
NoSQL を Ruby で実践するための n 個の方法NoSQL を Ruby で実践するための n 個の方法
NoSQL を Ruby で実践するための n 個の方法
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
 

Viewers also liked

More Than Websites: PHP And The Firehose @DataSift (2013)
More Than Websites: PHP And The Firehose @DataSift (2013)More Than Websites: PHP And The Firehose @DataSift (2013)
More Than Websites: PHP And The Firehose @DataSift (2013)Stuart Herbert
 
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custerdevopsdaysaustin
 
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...DevOpsDays Austin 2014
 
Elasticsearch 1.x Cluster Installation (VirtualBox)
Elasticsearch 1.x Cluster Installation (VirtualBox)Elasticsearch 1.x Cluster Installation (VirtualBox)
Elasticsearch 1.x Cluster Installation (VirtualBox)Amir Sedighi
 
An Introduction to Elasticsearch for Beginners
An Introduction to Elasticsearch for BeginnersAn Introduction to Elasticsearch for Beginners
An Introduction to Elasticsearch for BeginnersAmir Sedighi
 
Elasticsearch 101 - Cluster setup and tuning
Elasticsearch 101 - Cluster setup and tuningElasticsearch 101 - Cluster setup and tuning
Elasticsearch 101 - Cluster setup and tuningPetar Djekic
 
Elasticsearch cluster deep dive
Elasticsearch  cluster deep diveElasticsearch  cluster deep dive
Elasticsearch cluster deep diveChristophe Marchal
 
Scaling tokopedia-past-present-future
Scaling tokopedia-past-present-futureScaling tokopedia-past-present-future
Scaling tokopedia-past-present-futureRein Mahatma
 
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster Cloudera, Inc.
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
ElasticSearch Basic Introduction
ElasticSearch Basic IntroductionElasticSearch Basic Introduction
ElasticSearch Basic IntroductionMayur Rathod
 
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.com
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.comCross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.com
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.comErtuğ Karamatlı
 

Viewers also liked (12)

More Than Websites: PHP And The Firehose @DataSift (2013)
More Than Websites: PHP And The Firehose @DataSift (2013)More Than Websites: PHP And The Firehose @DataSift (2013)
More Than Websites: PHP And The Firehose @DataSift (2013)
 
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer
2016 - IGNITE - An ElasticSearch Cluster Named George Armstrong Custer
 
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...
The Five Stages of Chef Grief: My First 6 months with Chef, and Getting Aroun...
 
Elasticsearch 1.x Cluster Installation (VirtualBox)
Elasticsearch 1.x Cluster Installation (VirtualBox)Elasticsearch 1.x Cluster Installation (VirtualBox)
Elasticsearch 1.x Cluster Installation (VirtualBox)
 
An Introduction to Elasticsearch for Beginners
An Introduction to Elasticsearch for BeginnersAn Introduction to Elasticsearch for Beginners
An Introduction to Elasticsearch for Beginners
 
Elasticsearch 101 - Cluster setup and tuning
Elasticsearch 101 - Cluster setup and tuningElasticsearch 101 - Cluster setup and tuning
Elasticsearch 101 - Cluster setup and tuning
 
Elasticsearch cluster deep dive
Elasticsearch  cluster deep diveElasticsearch  cluster deep dive
Elasticsearch cluster deep dive
 
Scaling tokopedia-past-present-future
Scaling tokopedia-past-present-futureScaling tokopedia-past-present-future
Scaling tokopedia-past-present-future
 
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
HBaseCon 2013: Using Coprocessors to Index Columns in an Elasticsearch Cluster
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
ElasticSearch Basic Introduction
ElasticSearch Basic IntroductionElasticSearch Basic Introduction
ElasticSearch Basic Introduction
 
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.com
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.comCross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.com
Cross-Cluster and Cross-Datacenter Elasticsearch Replication at sahibinden.com
 

Similar to 06. ElasticSearch : Mapping and Analysis

Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyHarnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyAndré Ricardo Barreto de Oliveira
 
Elasticsearch for Data Engineers
Elasticsearch for Data EngineersElasticsearch for Data Engineers
Elasticsearch for Data EngineersDuy Do
 
Search Engine-Building with Lucene and Solr
Search Engine-Building with Lucene and SolrSearch Engine-Building with Lucene and Solr
Search Engine-Building with Lucene and SolrKai Chan
 
Complex queries in a distributed multi-model database
Complex queries in a distributed multi-model databaseComplex queries in a distributed multi-model database
Complex queries in a distributed multi-model databaseMax Neunhöffer
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchSperasoft
 
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIMEElasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIMEPiotr Pelczar
 
Elasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfElasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfInexture Solutions
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college projectAmitSharma397241
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in actionCodemotion
 
Elasticsearch an overview
Elasticsearch   an overviewElasticsearch   an overview
Elasticsearch an overviewAmit Juneja
 
Elastic search presentation 2
Elastic search presentation 2Elastic search presentation 2
Elastic search presentation 2Maruf Hassan
 
JLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingJLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingChase Tingley
 
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...NoSQLmatters
 

Similar to 06. ElasticSearch : Mapping and Analysis (20)

Language Search
Language SearchLanguage Search
Language Search
 
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyHarnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
 
Elasticsearch for Data Engineers
Elasticsearch for Data EngineersElasticsearch for Data Engineers
Elasticsearch for Data Engineers
 
Search Engine-Building with Lucene and Solr
Search Engine-Building with Lucene and SolrSearch Engine-Building with Lucene and Solr
Search Engine-Building with Lucene and Solr
 
Elastic tire demo
Elastic tire demoElastic tire demo
Elastic tire demo
 
Complex queries in a distributed multi-model database
Complex queries in a distributed multi-model databaseComplex queries in a distributed multi-model database
Complex queries in a distributed multi-model database
 
ElasticSearch
ElasticSearchElasticSearch
ElasticSearch
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
Javascript2839
Javascript2839Javascript2839
Javascript2839
 
Json
JsonJson
Json
 
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIMEElasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
 
Elasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfElasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdf
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Java script summary
Java script summaryJava script summary
Java script summary
 
ElasticSearch in action
ElasticSearch in actionElasticSearch in action
ElasticSearch in action
 
Elasticsearch an overview
Elasticsearch   an overviewElasticsearch   an overview
Elasticsearch an overview
 
Elastic search presentation 2
Elastic search presentation 2Elastic search presentation 2
Elastic search presentation 2
 
Json the-x-in-ajax1588
Json the-x-in-ajax1588Json the-x-in-ajax1588
Json the-x-in-ajax1588
 
JLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingJLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're going
 
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
 

More from OpenThink Labs

Program Outline in Regenerative Entrepreneurship
Program Outline in Regenerative EntrepreneurshipProgram Outline in Regenerative Entrepreneurship
Program Outline in Regenerative EntrepreneurshipOpenThink Labs
 
Low Carbon Development: A Paradigm Shift Towards a Green Economy in Indonesia
Low Carbon Development: A Paradigm Shift Towards a Green Economy in IndonesiaLow Carbon Development: A Paradigm Shift Towards a Green Economy in Indonesia
Low Carbon Development: A Paradigm Shift Towards a Green Economy in IndonesiaOpenThink Labs
 
Pedoman Sertifikasi Fitosanitari Buah Alpukat Indonesia
Pedoman Sertifikasi Fitosanitari Buah Alpukat IndonesiaPedoman Sertifikasi Fitosanitari Buah Alpukat Indonesia
Pedoman Sertifikasi Fitosanitari Buah Alpukat IndonesiaOpenThink Labs
 
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )OpenThink Labs
 
Mengenal Tipe-Tipe Reaktor Biogas
Mengenal Tipe-Tipe Reaktor BiogasMengenal Tipe-Tipe Reaktor Biogas
Mengenal Tipe-Tipe Reaktor BiogasOpenThink Labs
 
OpenThink SAS : Manajemen Data Induk Siswa
OpenThink SAS : Manajemen Data Induk SiswaOpenThink SAS : Manajemen Data Induk Siswa
OpenThink SAS : Manajemen Data Induk SiswaOpenThink Labs
 
A Simple Guide to the Item Response Theory (IRT) and Rasch Modeling
A Simple Guide to the Item Response Theory (IRT) and Rasch ModelingA Simple Guide to the Item Response Theory (IRT) and Rasch Modeling
A Simple Guide to the Item Response Theory (IRT) and Rasch ModelingOpenThink Labs
 
A Non-Technical Approach for Illustrating Item Response Theory
A Non-Technical Approach for Illustrating Item Response TheoryA Non-Technical Approach for Illustrating Item Response Theory
A Non-Technical Approach for Illustrating Item Response TheoryOpenThink Labs
 
Introduction to Item Response Theory
Introduction to Item Response TheoryIntroduction to Item Response Theory
Introduction to Item Response TheoryOpenThink Labs
 
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)OpenThink Labs
 
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...OpenThink Labs
 
Software Development : Change Request Template (2)
Software Development : Change Request Template (2)Software Development : Change Request Template (2)
Software Development : Change Request Template (2)OpenThink Labs
 
Software Development : Minutes of Meeting Form - Template
Software Development : Minutes of Meeting Form - TemplateSoftware Development : Minutes of Meeting Form - Template
Software Development : Minutes of Meeting Form - TemplateOpenThink Labs
 
Software Development : Change Request Template
Software Development : Change Request TemplateSoftware Development : Change Request Template
Software Development : Change Request TemplateOpenThink Labs
 

More from OpenThink Labs (15)

Program Outline in Regenerative Entrepreneurship
Program Outline in Regenerative EntrepreneurshipProgram Outline in Regenerative Entrepreneurship
Program Outline in Regenerative Entrepreneurship
 
Low Carbon Development: A Paradigm Shift Towards a Green Economy in Indonesia
Low Carbon Development: A Paradigm Shift Towards a Green Economy in IndonesiaLow Carbon Development: A Paradigm Shift Towards a Green Economy in Indonesia
Low Carbon Development: A Paradigm Shift Towards a Green Economy in Indonesia
 
Pedoman Sertifikasi Fitosanitari Buah Alpukat Indonesia
Pedoman Sertifikasi Fitosanitari Buah Alpukat IndonesiaPedoman Sertifikasi Fitosanitari Buah Alpukat Indonesia
Pedoman Sertifikasi Fitosanitari Buah Alpukat Indonesia
 
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )
Alpukat / Avokad ( Persea americana Mill / Persea gratissima Gaerth )
 
Ubi Cilembu
Ubi CilembuUbi Cilembu
Ubi Cilembu
 
Mengenal Tipe-Tipe Reaktor Biogas
Mengenal Tipe-Tipe Reaktor BiogasMengenal Tipe-Tipe Reaktor Biogas
Mengenal Tipe-Tipe Reaktor Biogas
 
OpenThink SAS : Manajemen Data Induk Siswa
OpenThink SAS : Manajemen Data Induk SiswaOpenThink SAS : Manajemen Data Induk Siswa
OpenThink SAS : Manajemen Data Induk Siswa
 
A Simple Guide to the Item Response Theory (IRT) and Rasch Modeling
A Simple Guide to the Item Response Theory (IRT) and Rasch ModelingA Simple Guide to the Item Response Theory (IRT) and Rasch Modeling
A Simple Guide to the Item Response Theory (IRT) and Rasch Modeling
 
A Non-Technical Approach for Illustrating Item Response Theory
A Non-Technical Approach for Illustrating Item Response TheoryA Non-Technical Approach for Illustrating Item Response Theory
A Non-Technical Approach for Illustrating Item Response Theory
 
Introduction to Item Response Theory
Introduction to Item Response TheoryIntroduction to Item Response Theory
Introduction to Item Response Theory
 
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)
Strategi Pembuatan Karya Ilmiah Bagi Anggota KIR (Kelompok Ilmiah Remaja)
 
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...
Software Development : Template Dokumen Uji Terima Aplikasi (User Acceptance ...
 
Software Development : Change Request Template (2)
Software Development : Change Request Template (2)Software Development : Change Request Template (2)
Software Development : Change Request Template (2)
 
Software Development : Minutes of Meeting Form - Template
Software Development : Minutes of Meeting Form - TemplateSoftware Development : Minutes of Meeting Form - Template
Software Development : Minutes of Meeting Form - Template
 
Software Development : Change Request Template
Software Development : Change Request TemplateSoftware Development : Change Request Template
Software Development : Change Request Template
 

Recently uploaded

RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxBoston Institute of Analytics
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Colleen Farrelly
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Cathrine Wilhelmsen
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...GQ Research
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxMike Bennett
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 

Recently uploaded (20)

RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptx
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 

06. ElasticSearch : Mapping and Analysis

  • 2. Mapping and Analysis GET /_search?q=2014 # 12 results GET /_search?q=2014-09-15 # 12 results ! GET /_search?q=date:2014-09-15 # 1 result GET /_search?q=date:2014 # 0 results ! GET /gb/_mapping/tweet { "gb": { "mappings": { "tweet": { "properties": { "date": { "type": "date", "format": "dateOptionalTime" }, "name": { "type": "string" }, "tweet": { "type": "string" }, "user_id": { "type": "long" } } } } } }
  • 3. Exact Values Versus Full Text ● Exact values are exactly what they sound like. Examples are a date or a user ID, but can also include exact strings such as a username or an email address. The exact value Foo is not the same as the exact value foo. The exact value 2014 is not the same as the exact value 2014-09-15 ● Full text, on the other hand, refers to textual data— usually written in some human language — like the    text of a tweet or the body of an email.
  • 4. Inverted Index ● For example, let’s say we have two documents, each with a content field containing the following: ● The quick brown fox jumped over the lazy dog ● Quick brown foxes leap over lazy dogs in summer ● Search for quick brown :
  • 5. Analysis and Analyzers ● Analysis is a process that consists of the following: ● First, tokenizing a block of text into individual terms suitable for use in an inverted index, ● Then normalizing these terms into a standard form to improve their “searchability,” or recall ● An analyzer is really just a wrapper that combines three functions into a single package: ● Character filters ● Tokenizer ● Token filters
  • 6. Analysis and Analyzers Built-in Analyzers ● Standard analyzer ● set, the, shape, to, semi, transparent, by, calling, set_trans, 5 ● Simple analyzer ● set, the, shape, to, semi, transparent, by, calling, set, trans ● Whitespace analyzer ● Set, the, shape, to, semi-transparent, by, calling, set_trans(5) ● Language analyzers ● set, shape, semi, transpar, call, set_tran, 5 "Set the shape to semi-transparent by calling set_trans(5)"
  • 7. Analysis and Analyzers Testing Analyzers GET /_analyze { "analyzer": "standard", "text": "Text to analyze" } { "tokens": [ { "token": "text", "start_offset": 0, "end_offset": 4, "type": "<ALPHANUM>", "position": 1 }, { "token": "to", "start_offset": 5, "end_offset": 7, "type": "<ALPHANUM>", "position": 2 }, { "token": "analyze", "start_offset": 8, "end_offset": 15, "type": "<ALPHANUM>", "position": 3 } ] }
  • 8. Analysis and Analyzers Specifying Analyzers ● When Elasticsearch detects a new string field in your documents, it automatically configures it as a full-text string field and analyzes it with the standard analyzer. ● We can apply a different analyzer that suits the language your data is in, by configuring these fields manually by specifying the mapping.
  • 9. Mapping Core Simple Field Types ● Elasticsearch supports the following simple field types: ● String: string ● Whole number: byte, short, integer, long ● Floating-point: float, double ● Boolean: boolean ● Date: date
  • 10. Mapping Viewing The Mapping GET /gb/_mapping/tweet { "gb": { "mappings": { "tweet": { "properties": { "date": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "name": { "type": "string" }, "tweet": { "type": "string" }, "user_id": { "type": "long" } } } } } }
  • 11. Mapping Customizing Field Mappings ● Custom mappings allow you to do the following: ● Distinguish between full-text string fields and exact value string fields ● Use language-specific analyzers ● Optimize a field for partial matching ● Specify custom date formats ● And much more { "number_of_clicks": { "type": "integer" } }
  • 12. Mapping Customizing Field Mappings ● The two most important mapping attributes for string fields are index and analyzer. ● index : The index attribute controls how the string will be indexed. It can contain one of three values: – analyzed : First analyze the string and then index it. In other words, index this field as full text. – not_analyzed : ndex this field, so it is searchable, but index the value exactly as specified. Do not analyze it. – No : Don’t index this field at all. This field will not be searchable. ● The default value of index for a string field is analyzed { "tag": { "type": "string", "index": "not_analyzed" } }
  • 13. Mapping Customizing Field Mappings ● analyzer ● For analyzed string fields, use the analyzer attribute to specify which analyzer to apply both at search time and at index time. By default, Elasticsearch uses the standard analyzer, but you can change this by specifying one of the built-in analyzers, such as whitespace, simple, or english: { "tweet": { "type": "string", "analyzer": "english" } }
  • 14. Mapping Updating a Mapping DELETE /gb PUT /gb { "mappings": { "tweet" : { "properties" : { "tweet" : { "type" : "string", "analyzer": "english" }, "date" : { "type" : "date" }, "name" : { "type" : "string" }, "user_id" : { "type" : "long" } } } } } PUT /gb/_mapping/tweet { "properties" : { "tag" : { "type" : "string", "index": "not_analyzed" } } } GET /gb/_analyze { "field": "tweet", "text": "Black-cats" } GET /gb/_analyze { "field": "tag", "text": "Black-cats" }
  • 15. Complex Core Field Types ● Besides the simple scalar datatypes that we have mentioned, JSON also has null values, arrays, and objects, all of which are supported by Elasticsearch. { "tag": [ "search", "nosql" ]} Multivalue Fields "null_value": null, "empty_array": [], "array_with_null_value": [ null ] Empty Fields
  • 16. Complex Core Field Types Multilevel Objects { "tweet": "Elasticsearch is very flexible", "user": { "id": "@johnsmith", "gender": "male", "age": 26, "name": { "full": "John Smith", "first": "John", "last": "Smith" } } }
  • 17. Complex Core Field Types Mapping for Inner Objects { "gb": { "tweet": { "properties": { "tweet": { "type": "string" }, "user": { "type": "object", "properties": { "id": { "type": "string" }, "gender": { "type": "string" }, "age": { "type": "long" }, "name": { "type": "object", "properties": { "full": { "type": "string" }, "first": { "type": "string" }, "last": { "type": "string" } } } } } } } } }
  • 18. Complex Core Field Types How Inner Objects are Indexed ● Lucene doesn’t understand inner objects. A Lucene document consists of a flat list of key-value pairs. In order for Elasticsearch to index inner objects usefully, it converts our document into something like this: { "tweet": [elasticsearch, flexible, very], "user.id": [@johnsmith], "user.gender": [male], "user.age": [26], "user.name.full": [john, smith], "user.name.first": [john], "user.name.last": [smith] }
  • 19. Complex Core Field Types Arrays of Inner Objects ● Finally, consider how an array containing inner objects would be indexed. Let’s say we have a followers array that looks like this: { "followers": [ { "age": 35, "name": "Mary White"}, { "age": 26, "name": "Alex Jones"}, { "age": 19, "name": "Lisa Smith"} ] } ● This document will be flattened as we described previously, but the result will look like this: { "followers.age": [19, 26, 35], "followers.name": [alex, jones, lisa, smith, mary, white] }
  • 20. Referensi ● ElasticSearch, The Definitive Guide, A Distrib uted Real-Time Search and Analytics Engine, Cl inton Gormely & Zachary Tong, O’Reilly