<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Elasticsearch</id>
	<title>Elasticsearch - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Elasticsearch"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Elasticsearch&amp;action=history"/>
	<updated>2026-05-02T18:54:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Elasticsearch&amp;diff=37938&amp;oldid=prev</id>
		<title>Bernard Szlachta: /* Query Rewrite⌘ */</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Elasticsearch&amp;diff=37938&amp;oldid=prev"/>
		<updated>2016-08-02T07:53:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Query Rewrite⌘&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Elasticsearch]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;true&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Elasticsearch&lt;br /&gt;
;author: Bernard Szlachta 安博 (NobleProg Ltd)&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
{{Can I use your material}}&lt;br /&gt;
&lt;br /&gt;
==Elasticsearch Access Control⌘==&lt;br /&gt;
# Access Control in ES (least secure)&lt;br /&gt;
## Shield&lt;br /&gt;
## Bespoke module&lt;br /&gt;
# Key-based bespoke - API Wrapper (fairly secure)&lt;br /&gt;
## Query Rewrite&lt;br /&gt;
## Query Filter&lt;br /&gt;
# Separate Servers (super secure)&lt;br /&gt;
;Other&lt;br /&gt;
# Network gateways&lt;br /&gt;
# Searchable data and encrypted data&lt;br /&gt;
# Backups of classified information&lt;br /&gt;
&lt;br /&gt;
== Access Control in ES ⌘==&lt;br /&gt;
=== Shield ⌘===&lt;br /&gt;
* ES plugin&lt;br /&gt;
* not free&lt;br /&gt;
* index level&lt;br /&gt;
* document level&lt;br /&gt;
* field level&lt;br /&gt;
* URL based access&lt;br /&gt;
* audit trail&lt;br /&gt;
* SSL/TSL encription (without cluster)&lt;br /&gt;
more https://www.elastic.co/guide/en/shield/current/configuring-rbac.html&lt;br /&gt;
&lt;br /&gt;
=== Shield: Index Level ⌘===&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;current_year_read&amp;quot;: {&lt;br /&gt;
       &amp;quot;cluster&amp;quot;:[],&lt;br /&gt;
       &amp;quot;indices&amp;quot;:[{&lt;br /&gt;
          &amp;quot;names&amp;quot;:[&amp;quot;current_year&amp;quot;],&lt;br /&gt;
          &amp;quot;privileges&amp;quot;:[&amp;quot;read&amp;quot;]}],&lt;br /&gt;
       &amp;quot;run_as&amp;quot;:[]&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Shield: Document Level ⌘===&lt;br /&gt;
&lt;br /&gt;
 POST /_shield/role/my_dls_role&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;indices&amp;quot;: [&lt;br /&gt;
     {&lt;br /&gt;
       &amp;quot;names&amp;quot;: [ &amp;quot;index1&amp;quot;, &amp;quot;index2&amp;quot; ],&lt;br /&gt;
       &amp;quot;privileges&amp;quot;: [&amp;quot;read&amp;quot;], &lt;br /&gt;
       &amp;quot;query&amp;quot;: {&amp;quot;term&amp;quot; : {&amp;quot;department_id&amp;quot; : &amp;quot;12&amp;quot;}} &lt;br /&gt;
     }&lt;br /&gt;
   ]&lt;br /&gt;
 }&lt;br /&gt;
=== Shield: Field Level ⌘===&lt;br /&gt;
 POST /_shield/role/my_fls_role&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;indices&amp;quot;: [&lt;br /&gt;
     {&lt;br /&gt;
       &amp;quot;names&amp;quot;: [ &amp;quot;index1&amp;quot;, &amp;quot;index2&amp;quot; ],&lt;br /&gt;
       &amp;quot;privileges&amp;quot;: [&amp;quot;read&amp;quot;], &lt;br /&gt;
       &amp;quot;fields&amp;quot;: [ &amp;quot;title&amp;quot;, &amp;quot;body&amp;quot; ]&lt;br /&gt;
     }&lt;br /&gt;
   ]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
cannot control other modules or upgrades - no way of assuring security&lt;br /&gt;
=== Access Control in ES - pros and cons ⌘===&lt;br /&gt;
;Pros&lt;br /&gt;
* no need of separate code&lt;br /&gt;
* arguably the fastest method&lt;br /&gt;
;Cons&lt;br /&gt;
* only standard API comply, other modules simply ignore Shield&lt;br /&gt;
* upgrading and compatibility problems&lt;br /&gt;
* hard to test&lt;br /&gt;
&lt;br /&gt;
=== Other in ES ===&lt;br /&gt;
* Scripts in ES&lt;br /&gt;
** Versioning, unit testing?&lt;br /&gt;
&lt;br /&gt;
== API Wrapper ⌘==&lt;br /&gt;
* Query Rewrite&lt;br /&gt;
* Result Filter&lt;br /&gt;
* Aggregated Result Problem&lt;br /&gt;
;Pros&lt;br /&gt;
* Existing permission system (e.g. application permission system, LDAP, etc...) can be implmeneted&lt;br /&gt;
;Cons&lt;br /&gt;
* Needs to be develop&lt;br /&gt;
* Speed (arguably)&lt;br /&gt;
&lt;br /&gt;
=== Query Rewrite⌘ ===&lt;br /&gt;
 GET _search&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;query&amp;quot;: {&lt;br /&gt;
       &amp;quot;match_all&amp;quot;: {}&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
;BECOMES&lt;br /&gt;
 GET _search {&lt;br /&gt;
   &amp;quot;query&amp;quot;: {&lt;br /&gt;
     &amp;quot;bool&amp;quot;: {&lt;br /&gt;
       &amp;quot;must&amp;quot;: {&lt;br /&gt;
         &amp;quot;match_all&amp;quot;: {}&lt;br /&gt;
       },&lt;br /&gt;
       &amp;quot;filter&amp;quot;: {&lt;br /&gt;
         &amp;quot;term&amp;quot;: {&lt;br /&gt;
           &amp;quot;roles&amp;quot;: &amp;quot;managers&amp;quot;&lt;br /&gt;
         }}}}}&lt;br /&gt;
&lt;br /&gt;
=== Query Rewrite⌘ ===&lt;br /&gt;
;Pros&lt;br /&gt;
# Very fast (almost no impact on performance)&lt;br /&gt;
# Upgrading ES have almost no impact on the logic and security &lt;br /&gt;
# Full control on how queries are rewritten&lt;br /&gt;
# Bespoke way handling aggregation (e.g. allow users to see totals of sales in departments, but not concrete documents)&lt;br /&gt;
;Cons&lt;br /&gt;
# Becoming more complex with complex queries (e.g. aggregation)&lt;br /&gt;
# May be tricky to test&lt;br /&gt;
&lt;br /&gt;
=== Filter API Wrapper ⌘ ===&lt;br /&gt;
* Filtering takes place in the API Wrapper&lt;br /&gt;
;Pros&lt;br /&gt;
* Full control over results&lt;br /&gt;
* Very easy to test&lt;br /&gt;
;Drawbacks&lt;br /&gt;
* Poor Performance&lt;br /&gt;
&lt;br /&gt;
==Elasticsearch Performance Testing with JMeter ⌘==&lt;br /&gt;
* JMeter - example with recording post and playing them up&lt;br /&gt;
* Use Chrome plugin&lt;br /&gt;
[[:Category:JMeter]]&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>