SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
Modernizing WordPress
Search with Elasticsearch
Who Am I?
• My name is Taylor Lovett!
• Director of Web Engineering at 10up
• Open source community member
• WordPress core contributor
• ElasticPress team member
@tlovett12
10up is hiring!
@tlovett12
taylor.lovett@10up.com
Doesn’t WordPress have
search built-in?
WordPress Search is Rudimentary
• Only searches post title, content, and excerpt.
• Relies on MySQL and thus is slow.
• Relevancy calculations are poor and overly
simplistic.
• Not able to handle any advanced filtering.
What is Elasticsearch?
http://www.elasticsearch.org/
Elasticsearch
• Open-source search server written in Java
based on a technology called Lucene (open-
source search software by Apache).
• A standalone database server that provides a
RESTful interface to accept and store data in a
way that is optimized for search.
• Extremely scalable, performant, and reliable
Elasticsearch
• Relevant results
• Autosuggest
• Fuzzy matching
• Geographic searches
• Filterable searches
• Data weighting
• Much more
Get an Elasticsearch Server
• Very flexible and customizable. There is not
really a “one size fits all” setup. Generally, you
have two options:
• Option 1: Pay someone else to manage/host
your Elasticsearch cluster (SaaS)
• Option 2: Host your own cluster
Elasticsearch SaaS
• found.no
• qbox.io
• heroku.com
• etc…
Let’s setup our own
Elasticsearch cluster.
Elasticsearch Self-Hosted Cluster
• Make sure you have Java installed.
• Download Elasticsearch:

http://www.elasticsearch.org/downloads/1-4-2/
• Assuming you are installing on a Linux
distribution, you can easily install using DEB or
RPM packages.
Configuring Your Cluster
Install Elasticsearch on it’s own box or
VM!
Configuring Your Cluster (cont.)
• How much memory is available to the heap?

Configure your Elasticsearch heap size (~half of available RAM,
defaults to 256M min and 1G max):



ES_HEAP_SIZE=512m in /etc/default/elasticsearch
• Can the current process be swapped?

Disable process swapping for Elasticsearch:



bootstrap.mlockall: true in config/elasticsearch.yml



“Linux kernel tries to use as much memory as possible for file system caches and
swaps out unused application memory, possibly resulting in the Elasticsearch
process being swapped. Swapping is very bad for performance and for node
stability.” See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/
setup-configuration.html.
Configuring Your Cluster (cont.)
• How much memory can the current system user acquire? 

Raise resources that system user can acquire:



In /etc/security/limits.conf:

elasticsearch - memlock unlimited



In /etc/default/elasticsearch

MAX_LOCKED_MEMORY=unlimited
• How many files can the current system user have open? 

Raise *nix file limit (65535 is ES default):



In /etc/security/limits.conf:

elasticsearch - nofile 65535
Configuring Your Cluster (cont.)
• Can Elasticsearch execute dynamic scripts in
queries?

Disable dynamic scripting (potentially
dangerous and usually unnecessary)



In /etc/elasticsearch/elasticsearch.yml

script.disable_dynamic: true
Start Your Server
• Assuming you installed Elasticsearch as a
service on a Linux/Unix distribution:



sudo service elasticsearch start
Hello World!
• You should be able to view http://
yourdomainorIP:9200 and see some JSON.
• If this doesn’t work, try SSH’ing into your ES
server and doing a cURL to localhost:

curl http://localhost:9200
Cluster Health
• View http://yourdomainorIP:9200/_cluster/health



You will see something like this:

{

"cluster_name":"elasticsearch",

"status":"yellow",

"timed_out":false,

“number_of_nodes":1,

"number_of_data_nodes":1,

“active_primary_shards":5,

"active_shards":5,

"relocating_shards":0,

"initializing_shards":0,

"unassigned_shards":5

}
Cluster Health (cont.)
• “active_primary_shards”: Number of primary
(non-replica) shards that are active and available.
• shard: Every document (post) lives on a shard.
Indexes are divided into shards (5 by default).
There are primary and replica shards. Replica
shards help with failover. Shards are distributed
across nodes evenly and help with parallel
processing. A shard replica must live on a
different node than the primary.
Cluster Health (cont.)
• “cluster_name”: Elasticsearch is meant to be a
distributed search database. A cluster is one or
more nodes.
• Node: A single server on your cluster. Nodes
can be set up to store data or as master nodes.
• “number_of_nodes”: This is the number of
nodes in your cluster.
Cluster Health (cont.)
• “status”: There are three statuses possible:



Red: Not all primary shards are available



Yellow: Primary shards are available but
replicas are not.



Green: Cluster is fully operational with primary
and replica shards
Cluster Health (cont.)
• Cluster status is yellow because there is only
one node. Replica shards need to be assigned
to a different node than their primary; this is not
possible in our current setup.
• It’s good practice to create at least 2 nodes in
our production clusters.
Security
• Elasticsearch has no concept of security,
authentication, or authorization built-in.
• By default, your instance is open to the world.
Good for development, but bad for production.
Private Instance
• We can easily lock down your ES instance



In /etc/elasticsearch/elasticsearch.yml

network.host: localhost!
• Note: this will make it difficult to navigate your ES
instance in your web browser which is useful for
debugging. We can also do something like
setup a reverse proxy (using Nginx) with a
password protected endpoint to get around this.
Now that we have gone through
Elasticsearch basics, let’s talk
about integrating Elasticsearch
with WordPress.
What is ElasticPress?
https://github.com/10up/elasticpress
ElasticPress
A free 10up WordPress plugin that powers
WordPress search with Elasticsearch.
ElasticPress
• Build filterable performant queries (filter by taxonomy
term, post meta key, etc.)
• Fuzzy search post title, content, excerpt, taxonomy
terms, post meta, and authors
• Search across multiple blogs in a multi-site instance
• Results returned by relevancy. Relevancy calculations
are highly customizable.
• Very extensible and performant
ElasticPress Requirements
!
• WordPress 3.7+
• A host (not WordPress.com VIP) that either gives
SSH access or the ability to run WP-CLI
commands.
• An instance of Elasticsearch.
• WP-CLI
Installation
• Github: http://github.com/10up/elasticpress
• WordPress.org: http://wordpress.org/plugins/
elasticpress
Point to Your ES Instance
• In your wp-config.php file, add the following
where the URL is the domain or IP of your
Elasticsearch instance:



define( 'EP_HOST', 'http://192.168.50.4:9200' );
Index Your Posts
• Just activating the plugin will do nothing. We need
to run a WP-CLI command:



wp elasticpress index --setup [--network-wide]!
• --network-wide will force indexing across all the
blogs on a network of sites in multisite. This is
required if you plan to do cross-site search. It’s
basically a shortcut so you don’t have to run the
command once with the --url parameter for each
of your blogs.
What Happens Next?
• Once ElasticPress is activated and posts are
indexed, it will integrate with WP_Query to run
queries against Elasticsearch instead of MySQL.
• WP_Query integration will only happen on
search queries (“s” parameter) or when the
ep_integrate parameter is passed.
Query Integration
new WP_Query( array(

’s’ => ‘search terms’,

‘author_name’ => ‘taylor’,

…

) );!
new WP_Query( array(

’ep_integrate’ => ‘true’,

‘author_name’ => ‘taylor’,

…

) );!
new WP_Query( array(

‘author_name’ => ‘taylor’,

…

) );
Note on Search
• We can use ElasticPress to power queries
OTHER than search! This is powerful.
Advanced Queries
• ElasticPress uses Elasticsearch to do many cool types of queries in a
performant manner. By passing special params to a WP_Query object we can:
• Search taxonomy terms
• Filter by taxonomy terms (unlimited dimensions)
• Search post meta
• Filter by post meta (unlimited dimensions)
• Search authors
• Filter by authors
• Search across blogs in multisite
• more!
Example Queries
new WP_Query( array(

’s’ => ‘paris france’,

‘sites’ => ‘all’,

) );
Example Queries
new WP_Query( array(

’s’ => ‘paris france’,

‘search_fields’ => array(

‘post_title’,

‘post_content’,

‘taxonomies’ => array( ‘category’ ),

),

) );
Example Queries
new WP_Query( array(

’s’ => ‘paris france’,

‘post_type’ => ‘page’,

‘author_name’ => ‘taylor’,

‘search_fields’ => array(

‘post_title’,

‘post_content’,

‘meta’ => array( ‘city_name’ ),

),

) );
Example Queries
new WP_Query( array(

’s’ => ‘paris france’,

‘tax_query’ => array(

array(

‘taxonomy’ => ‘category’,

‘terms’ => array( ‘term1’, ‘term2’ ),

),

),

‘search_fields’ => array(

‘post_title’,

‘post_content’,

‘meta’ => array( ‘city_name’ ),

‘author_name’,

),

‘site’ => 3,

) );
WP_Query Integration
• The goal for ElasticPress is to make WP_Query
work behind the scenes through Elasticsearch
and provide extra functionality.
• This means we have to support every query
parameter which isn’t the case yet. Github
contains a full list of parameters WP_Query
supports with ElasticPress and usage for each
parameter.
Elasticsearch in Your Language
• Elasticsearch is designed to be
internationalized.
• Out of the box, it will work fine with most
languages.
Analysis and Analyzers
• When a document is indexed in Elasticsearch,
text is analyzed, broken into terms (tokenized),
and normalized with token filters.
• In normalization, strings might be lowercased
and plurals stripped.
Custom Analyzers
• ElasticPress by default uses a pretty standard set of
analyzers intended for the English language.
• We can easily customize our analyzers for use with
other languages by filtering ep_config_mapping
(see EP source code).!
• You can read about language specific analyzers here:



http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/analysis-lang-analyzer.html
Documentation
Full documentation with installation instructions:



https://github.com/10up/ElasticPress
Feedback and Continuing Development
• If you are using ElasticPress on a project, please
let us know and give us feedback!
• Pull requests are welcome!
Questions?
We need to send a PUT request to this endpoint with
our post data. Of course we must authenticate before
doing this.
@tlovett12!
taylor.lovett@10up.com!
taylorlovett.com

Mais conteúdo relacionado

Mais procurados

Change Management
Change ManagementChange Management
Change Managementramikanso
 
ITIL v3 Foundation Presentation
ITIL v3 Foundation PresentationITIL v3 Foundation Presentation
ITIL v3 Foundation PresentationWajahat Rajab
 
Managed Services Using SLAs and KPIs
Managed Services Using SLAs and KPIsManaged Services Using SLAs and KPIs
Managed Services Using SLAs and KPIsProlifics
 
(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach
(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach
(ONLINE) ITIL Indonesia Community - IT Operation Practical ApproachITIL Indonesia
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
ITIL Service Transition
ITIL Service TransitionITIL Service Transition
ITIL Service TransitionMarvin Sirait
 
Resolve Incidents Faster: Transforming Your Incident Management Process
Resolve Incidents Faster: Transforming Your Incident Management ProcessResolve Incidents Faster: Transforming Your Incident Management Process
Resolve Incidents Faster: Transforming Your Incident Management ProcessAtlassian
 
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014Amazon Web Services
 
IT Service Management Overview
IT Service Management OverviewIT Service Management Overview
IT Service Management OverviewAhmed Al-Hadidi
 
A Starter Guide to IT Managed Services
A Starter Guide to IT Managed ServicesA Starter Guide to IT Managed Services
A Starter Guide to IT Managed ServicesDavid Castro
 
ITIL Service Operation 2011
ITIL Service Operation 2011ITIL Service Operation 2011
ITIL Service Operation 2011Marvin Sirait
 
Azure Application insights - An Introduction
Azure Application insights - An IntroductionAzure Application insights - An Introduction
Azure Application insights - An IntroductionMatthias Güntert
 
Deep-Dive to Application Insights
Deep-Dive to Application Insights Deep-Dive to Application Insights
Deep-Dive to Application Insights Gunnar Peipman
 
A Brief about IT Managed Services
A Brief about IT Managed ServicesA Brief about IT Managed Services
A Brief about IT Managed ServicesFlightcase1
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Deepu K Sasidharan
 
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processes
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processesITIL foundations - Complete introduction to ITIL phases, lifecycle and processes
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processesRichard Grieman
 
6 itil v3 service operation v1.8
6 itil v3 service operation v1.86 itil v3 service operation v1.8
6 itil v3 service operation v1.8Karthik Arumugham
 
Information Technology Infrastructure Library
Information Technology Infrastructure LibraryInformation Technology Infrastructure Library
Information Technology Infrastructure LibraryCOEPD HR
 

Mais procurados (20)

Change Management
Change ManagementChange Management
Change Management
 
ITIL v3 Foundation Presentation
ITIL v3 Foundation PresentationITIL v3 Foundation Presentation
ITIL v3 Foundation Presentation
 
Managed Services Using SLAs and KPIs
Managed Services Using SLAs and KPIsManaged Services Using SLAs and KPIs
Managed Services Using SLAs and KPIs
 
(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach
(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach
(ONLINE) ITIL Indonesia Community - IT Operation Practical Approach
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
ITIL Service Transition
ITIL Service TransitionITIL Service Transition
ITIL Service Transition
 
Resolve Incidents Faster: Transforming Your Incident Management Process
Resolve Incidents Faster: Transforming Your Incident Management ProcessResolve Incidents Faster: Transforming Your Incident Management Process
Resolve Incidents Faster: Transforming Your Incident Management Process
 
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014
(WEB202) Best Practices for Handling a 20x Traffic Spike | AWS re:Invent 2014
 
IT Service Management Overview
IT Service Management OverviewIT Service Management Overview
IT Service Management Overview
 
Alfresco Share, en español
Alfresco Share, en españolAlfresco Share, en español
Alfresco Share, en español
 
A Starter Guide to IT Managed Services
A Starter Guide to IT Managed ServicesA Starter Guide to IT Managed Services
A Starter Guide to IT Managed Services
 
ITIL Service Operation 2011
ITIL Service Operation 2011ITIL Service Operation 2011
ITIL Service Operation 2011
 
Azure Application insights - An Introduction
Azure Application insights - An IntroductionAzure Application insights - An Introduction
Azure Application insights - An Introduction
 
ITIL for Dummies
ITIL for DummiesITIL for Dummies
ITIL for Dummies
 
Deep-Dive to Application Insights
Deep-Dive to Application Insights Deep-Dive to Application Insights
Deep-Dive to Application Insights
 
A Brief about IT Managed Services
A Brief about IT Managed ServicesA Brief about IT Managed Services
A Brief about IT Managed Services
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
 
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processes
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processesITIL foundations - Complete introduction to ITIL phases, lifecycle and processes
ITIL foundations - Complete introduction to ITIL phases, lifecycle and processes
 
6 itil v3 service operation v1.8
6 itil v3 service operation v1.86 itil v3 service operation v1.8
6 itil v3 service operation v1.8
 
Information Technology Infrastructure Library
Information Technology Infrastructure LibraryInformation Technology Infrastructure Library
Information Technology Infrastructure Library
 

Destaque

Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearchTaylor Lovett
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchTaylor Lovett
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
Best Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseBest Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseTaylor Lovett
 
What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer ScienceTaylor Lovett
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPressTaylor Lovett
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHPTaylor Lovett
 
Isomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPIsomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPTaylor Lovett
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPressTaylor Lovett
 
Saving Time with WP-CLI
Saving Time with WP-CLISaving Time with WP-CLI
Saving Time with WP-CLITaylor Lovett
 
Elasticsearch at Automattic
Elasticsearch at AutomatticElasticsearch at Automattic
Elasticsearch at AutomatticGreg Brown
 
Como Insertar una hoja de cálculo de Google docs
Como Insertar una hoja de cálculo de Google docsComo Insertar una hoja de cálculo de Google docs
Como Insertar una hoja de cálculo de Google docsJuan José de Haro
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageGreg Brown
 
L’i18n et les outils de l10n en 2015 - WCParis 2015
L’i18n et les outils de l10n en 2015 - WCParis 2015L’i18n et les outils de l10n en 2015 - WCParis 2015
L’i18n et les outils de l10n en 2015 - WCParis 2015Bénard François-Xavier
 
Présentation WordCamp Paris 2015 - Inside da WeB
Présentation WordCamp Paris 2015 - Inside da WeBPrésentation WordCamp Paris 2015 - Inside da WeB
Présentation WordCamp Paris 2015 - Inside da WeBSébastien Grillot
 
Décoller votre site avec Jetpack
Décoller votre site avec JetpackDécoller votre site avec Jetpack
Décoller votre site avec JetpackRichard Archambault
 
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)Ozh
 
Wordcamp paris 2015 dev-pragmatique-bonnes-pratiques
Wordcamp paris 2015  dev-pragmatique-bonnes-pratiquesWordcamp paris 2015  dev-pragmatique-bonnes-pratiques
Wordcamp paris 2015 dev-pragmatique-bonnes-pratiquesSylvie Clément
 
Développer en javascript une extension de A a Z
Développer en javascript une extension de A a ZDévelopper en javascript une extension de A a Z
Développer en javascript une extension de A a ZNicolas Juen
 

Destaque (20)

Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearch
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Best Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseBest Practices for WordPress in Enterprise
Best Practices for WordPress in Enterprise
 
What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer Science
 
Fluxible
FluxibleFluxible
Fluxible
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHP
 
Isomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPIsomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWP
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
 
Saving Time with WP-CLI
Saving Time with WP-CLISaving Time with WP-CLI
Saving Time with WP-CLI
 
Elasticsearch at Automattic
Elasticsearch at AutomatticElasticsearch at Automattic
Elasticsearch at Automattic
 
Como Insertar una hoja de cálculo de Google docs
Como Insertar una hoja de cálculo de Google docsComo Insertar una hoja de cálculo de Google docs
Como Insertar una hoja de cálculo de Google docs
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch Usage
 
L’i18n et les outils de l10n en 2015 - WCParis 2015
L’i18n et les outils de l10n en 2015 - WCParis 2015L’i18n et les outils de l10n en 2015 - WCParis 2015
L’i18n et les outils de l10n en 2015 - WCParis 2015
 
Présentation WordCamp Paris 2015 - Inside da WeB
Présentation WordCamp Paris 2015 - Inside da WeBPrésentation WordCamp Paris 2015 - Inside da WeB
Présentation WordCamp Paris 2015 - Inside da WeB
 
Décoller votre site avec Jetpack
Décoller votre site avec JetpackDécoller votre site avec Jetpack
Décoller votre site avec Jetpack
 
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)
WordPress Plugin Unit Tests (FR - WordCamp Paris 2015)
 
Wordcamp paris 2015 dev-pragmatique-bonnes-pratiques
Wordcamp paris 2015  dev-pragmatique-bonnes-pratiquesWordcamp paris 2015  dev-pragmatique-bonnes-pratiques
Wordcamp paris 2015 dev-pragmatique-bonnes-pratiques
 
Développer en javascript une extension de A a Z
Développer en javascript une extension de A a ZDévelopper en javascript une extension de A a Z
Développer en javascript une extension de A a Z
 

Semelhante a Modernizing WordPress Search with Elasticsearch

Getting started with Laravel & Elasticsearch
Getting started with Laravel & ElasticsearchGetting started with Laravel & Elasticsearch
Getting started with Laravel & ElasticsearchPeter Steenbergen
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearchErhwen Kuo
 
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search EngineElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search EngineDaniel N
 
Real time analytics using Hadoop and Elasticsearch
Real time analytics using Hadoop and ElasticsearchReal time analytics using Hadoop and Elasticsearch
Real time analytics using Hadoop and ElasticsearchAbhishek Andhavarapu
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Taylor Lovett
 
Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearchbart-sk
 
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data AnalyticsAmazon Web Services
 
Elasticsearch in Production
Elasticsearch in ProductionElasticsearch in Production
Elasticsearch in Productionfoundsearch
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
Search and analyze your data with elasticsearch
Search and analyze your data with elasticsearchSearch and analyze your data with elasticsearch
Search and analyze your data with elasticsearchAnton Udovychenko
 
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...Using ElasticSearch as a fast, flexible, and scalable solution to search occu...
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...kristgen
 
Elk presentation1#3
Elk presentation1#3Elk presentation1#3
Elk presentation1#3uzzal basak
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화NAVER D2
 
[2 d1] elasticsearch 성능 최적화
[2 d1] elasticsearch 성능 최적화[2 d1] elasticsearch 성능 최적화
[2 d1] elasticsearch 성능 최적화Henry Jeong
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaPrajal Kulkarni
 
How ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps lifeHow ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps life琛琳 饶
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning ElasticsearchAnurag Patel
 

Semelhante a Modernizing WordPress Search with Elasticsearch (20)

Getting started with Laravel & Elasticsearch
Getting started with Laravel & ElasticsearchGetting started with Laravel & Elasticsearch
Getting started with Laravel & Elasticsearch
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
 
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search EngineElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
 
Real time analytics using Hadoop and Elasticsearch
Real time analytics using Hadoop and ElasticsearchReal time analytics using Hadoop and Elasticsearch
Real time analytics using Hadoop and Elasticsearch
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch
 
Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearch
 
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics
(BDT209) Launch: Amazon Elasticsearch For Real-Time Data Analytics
 
Elasticsearch in Production
Elasticsearch in ProductionElasticsearch in Production
Elasticsearch in Production
 
Elasticsearch Introduction
Elasticsearch IntroductionElasticsearch Introduction
Elasticsearch Introduction
 
Cassandra
CassandraCassandra
Cassandra
 
Search and analyze your data with elasticsearch
Search and analyze your data with elasticsearchSearch and analyze your data with elasticsearch
Search and analyze your data with elasticsearch
 
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...Using ElasticSearch as a fast, flexible, and scalable solution to search occu...
Using ElasticSearch as a fast, flexible, and scalable solution to search occu...
 
Elk presentation1#3
Elk presentation1#3Elk presentation1#3
Elk presentation1#3
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화
 
[2 d1] elasticsearch 성능 최적화
[2 d1] elasticsearch 성능 최적화[2 d1] elasticsearch 성능 최적화
[2 d1] elasticsearch 성능 최적화
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
How ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps lifeHow ElasticSearch lives in my DevOps life
How ElasticSearch lives in my DevOps life
 
Elastic pivorak
Elastic pivorakElastic pivorak
Elastic pivorak
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning Elasticsearch
 
Elastic search
Elastic searchElastic search
Elastic search
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Modernizing WordPress Search with Elasticsearch

  • 2. Who Am I? • My name is Taylor Lovett! • Director of Web Engineering at 10up • Open source community member • WordPress core contributor • ElasticPress team member @tlovett12
  • 5. WordPress Search is Rudimentary • Only searches post title, content, and excerpt. • Relies on MySQL and thus is slow. • Relevancy calculations are poor and overly simplistic. • Not able to handle any advanced filtering.
  • 7. Elasticsearch • Open-source search server written in Java based on a technology called Lucene (open- source search software by Apache). • A standalone database server that provides a RESTful interface to accept and store data in a way that is optimized for search. • Extremely scalable, performant, and reliable
  • 8. Elasticsearch • Relevant results • Autosuggest • Fuzzy matching • Geographic searches • Filterable searches • Data weighting • Much more
  • 9. Get an Elasticsearch Server • Very flexible and customizable. There is not really a “one size fits all” setup. Generally, you have two options: • Option 1: Pay someone else to manage/host your Elasticsearch cluster (SaaS) • Option 2: Host your own cluster
  • 10. Elasticsearch SaaS • found.no • qbox.io • heroku.com • etc…
  • 11. Let’s setup our own Elasticsearch cluster.
  • 12. Elasticsearch Self-Hosted Cluster • Make sure you have Java installed. • Download Elasticsearch:
 http://www.elasticsearch.org/downloads/1-4-2/ • Assuming you are installing on a Linux distribution, you can easily install using DEB or RPM packages.
  • 13. Configuring Your Cluster Install Elasticsearch on it’s own box or VM!
  • 14. Configuring Your Cluster (cont.) • How much memory is available to the heap?
 Configure your Elasticsearch heap size (~half of available RAM, defaults to 256M min and 1G max):
 
 ES_HEAP_SIZE=512m in /etc/default/elasticsearch • Can the current process be swapped?
 Disable process swapping for Elasticsearch:
 
 bootstrap.mlockall: true in config/elasticsearch.yml
 
 “Linux kernel tries to use as much memory as possible for file system caches and swaps out unused application memory, possibly resulting in the Elasticsearch process being swapped. Swapping is very bad for performance and for node stability.” See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/ setup-configuration.html.
  • 15. Configuring Your Cluster (cont.) • How much memory can the current system user acquire? 
 Raise resources that system user can acquire:
 
 In /etc/security/limits.conf:
 elasticsearch - memlock unlimited
 
 In /etc/default/elasticsearch
 MAX_LOCKED_MEMORY=unlimited • How many files can the current system user have open? 
 Raise *nix file limit (65535 is ES default):
 
 In /etc/security/limits.conf:
 elasticsearch - nofile 65535
  • 16. Configuring Your Cluster (cont.) • Can Elasticsearch execute dynamic scripts in queries?
 Disable dynamic scripting (potentially dangerous and usually unnecessary)
 
 In /etc/elasticsearch/elasticsearch.yml
 script.disable_dynamic: true
  • 17. Start Your Server • Assuming you installed Elasticsearch as a service on a Linux/Unix distribution:
 
 sudo service elasticsearch start
  • 18. Hello World! • You should be able to view http:// yourdomainorIP:9200 and see some JSON. • If this doesn’t work, try SSH’ing into your ES server and doing a cURL to localhost:
 curl http://localhost:9200
  • 19. Cluster Health • View http://yourdomainorIP:9200/_cluster/health
 
 You will see something like this:
 {
 "cluster_name":"elasticsearch",
 "status":"yellow",
 "timed_out":false,
 “number_of_nodes":1,
 "number_of_data_nodes":1,
 “active_primary_shards":5,
 "active_shards":5,
 "relocating_shards":0,
 "initializing_shards":0,
 "unassigned_shards":5
 }
  • 20. Cluster Health (cont.) • “active_primary_shards”: Number of primary (non-replica) shards that are active and available. • shard: Every document (post) lives on a shard. Indexes are divided into shards (5 by default). There are primary and replica shards. Replica shards help with failover. Shards are distributed across nodes evenly and help with parallel processing. A shard replica must live on a different node than the primary.
  • 21. Cluster Health (cont.) • “cluster_name”: Elasticsearch is meant to be a distributed search database. A cluster is one or more nodes. • Node: A single server on your cluster. Nodes can be set up to store data or as master nodes. • “number_of_nodes”: This is the number of nodes in your cluster.
  • 22. Cluster Health (cont.) • “status”: There are three statuses possible:
 
 Red: Not all primary shards are available
 
 Yellow: Primary shards are available but replicas are not.
 
 Green: Cluster is fully operational with primary and replica shards
  • 23. Cluster Health (cont.) • Cluster status is yellow because there is only one node. Replica shards need to be assigned to a different node than their primary; this is not possible in our current setup. • It’s good practice to create at least 2 nodes in our production clusters.
  • 24. Security • Elasticsearch has no concept of security, authentication, or authorization built-in. • By default, your instance is open to the world. Good for development, but bad for production.
  • 25. Private Instance • We can easily lock down your ES instance
 
 In /etc/elasticsearch/elasticsearch.yml
 network.host: localhost! • Note: this will make it difficult to navigate your ES instance in your web browser which is useful for debugging. We can also do something like setup a reverse proxy (using Nginx) with a password protected endpoint to get around this.
  • 26. Now that we have gone through Elasticsearch basics, let’s talk about integrating Elasticsearch with WordPress.
  • 28. ElasticPress A free 10up WordPress plugin that powers WordPress search with Elasticsearch.
  • 29. ElasticPress • Build filterable performant queries (filter by taxonomy term, post meta key, etc.) • Fuzzy search post title, content, excerpt, taxonomy terms, post meta, and authors • Search across multiple blogs in a multi-site instance • Results returned by relevancy. Relevancy calculations are highly customizable. • Very extensible and performant
  • 30. ElasticPress Requirements ! • WordPress 3.7+ • A host (not WordPress.com VIP) that either gives SSH access or the ability to run WP-CLI commands. • An instance of Elasticsearch. • WP-CLI
  • 31. Installation • Github: http://github.com/10up/elasticpress • WordPress.org: http://wordpress.org/plugins/ elasticpress
  • 32. Point to Your ES Instance • In your wp-config.php file, add the following where the URL is the domain or IP of your Elasticsearch instance:
 
 define( 'EP_HOST', 'http://192.168.50.4:9200' );
  • 33. Index Your Posts • Just activating the plugin will do nothing. We need to run a WP-CLI command:
 
 wp elasticpress index --setup [--network-wide]! • --network-wide will force indexing across all the blogs on a network of sites in multisite. This is required if you plan to do cross-site search. It’s basically a shortcut so you don’t have to run the command once with the --url parameter for each of your blogs.
  • 34. What Happens Next? • Once ElasticPress is activated and posts are indexed, it will integrate with WP_Query to run queries against Elasticsearch instead of MySQL. • WP_Query integration will only happen on search queries (“s” parameter) or when the ep_integrate parameter is passed.
  • 35. Query Integration new WP_Query( array(
 ’s’ => ‘search terms’,
 ‘author_name’ => ‘taylor’,
 …
 ) );! new WP_Query( array(
 ’ep_integrate’ => ‘true’,
 ‘author_name’ => ‘taylor’,
 …
 ) );! new WP_Query( array(
 ‘author_name’ => ‘taylor’,
 …
 ) );
  • 36. Note on Search • We can use ElasticPress to power queries OTHER than search! This is powerful.
  • 37. Advanced Queries • ElasticPress uses Elasticsearch to do many cool types of queries in a performant manner. By passing special params to a WP_Query object we can: • Search taxonomy terms • Filter by taxonomy terms (unlimited dimensions) • Search post meta • Filter by post meta (unlimited dimensions) • Search authors • Filter by authors • Search across blogs in multisite • more!
  • 38. Example Queries new WP_Query( array(
 ’s’ => ‘paris france’,
 ‘sites’ => ‘all’,
 ) );
  • 39. Example Queries new WP_Query( array(
 ’s’ => ‘paris france’,
 ‘search_fields’ => array(
 ‘post_title’,
 ‘post_content’,
 ‘taxonomies’ => array( ‘category’ ),
 ),
 ) );
  • 40. Example Queries new WP_Query( array(
 ’s’ => ‘paris france’,
 ‘post_type’ => ‘page’,
 ‘author_name’ => ‘taylor’,
 ‘search_fields’ => array(
 ‘post_title’,
 ‘post_content’,
 ‘meta’ => array( ‘city_name’ ),
 ),
 ) );
  • 41. Example Queries new WP_Query( array(
 ’s’ => ‘paris france’,
 ‘tax_query’ => array(
 array(
 ‘taxonomy’ => ‘category’,
 ‘terms’ => array( ‘term1’, ‘term2’ ),
 ),
 ),
 ‘search_fields’ => array(
 ‘post_title’,
 ‘post_content’,
 ‘meta’ => array( ‘city_name’ ),
 ‘author_name’,
 ),
 ‘site’ => 3,
 ) );
  • 42. WP_Query Integration • The goal for ElasticPress is to make WP_Query work behind the scenes through Elasticsearch and provide extra functionality. • This means we have to support every query parameter which isn’t the case yet. Github contains a full list of parameters WP_Query supports with ElasticPress and usage for each parameter.
  • 43. Elasticsearch in Your Language • Elasticsearch is designed to be internationalized. • Out of the box, it will work fine with most languages.
  • 44. Analysis and Analyzers • When a document is indexed in Elasticsearch, text is analyzed, broken into terms (tokenized), and normalized with token filters. • In normalization, strings might be lowercased and plurals stripped.
  • 45. Custom Analyzers • ElasticPress by default uses a pretty standard set of analyzers intended for the English language. • We can easily customize our analyzers for use with other languages by filtering ep_config_mapping (see EP source code).! • You can read about language specific analyzers here:
 
 http://www.elasticsearch.org/guide/en/elasticsearch/ reference/current/analysis-lang-analyzer.html
  • 46. Documentation Full documentation with installation instructions:
 
 https://github.com/10up/ElasticPress
  • 47. Feedback and Continuing Development • If you are using ElasticPress on a project, please let us know and give us feedback! • Pull requests are welcome!
  • 48. Questions? We need to send a PUT request to this endpoint with our post data. Of course we must authenticate before doing this. @tlovett12! taylor.lovett@10up.com! taylorlovett.com