<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mallikarjun H T</title>
    <description>The latest articles on DEV Community by Mallikarjun H T (@mallikarjunht).</description>
    <link>https://dev.to/mallikarjunht</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F406157%2F99e182ce-68ed-44c4-a88a-167c507c7aa7.jpg</url>
      <title>DEV Community: Mallikarjun H T</title>
      <link>https://dev.to/mallikarjunht</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mallikarjunht"/>
    <language>en</language>
    <item>
      <title>Giving Claude Code a Real Engineering Process</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Thu, 17 Sep 2026 04:44:26 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/giving-claude-code-a-real-engineering-process-2a0</link>
      <guid>https://dev.to/mallikarjunht/giving-claude-code-a-real-engineering-process-2a0</guid>
      <description>&lt;h1&gt;
  
  
  Wizard: Giving Claude Code a Real Engineering Process
&lt;/h1&gt;

&lt;p&gt;Ask an AI coding agent to "fix the bug" and it will fix &lt;em&gt;a&lt;/em&gt; bug — usually the&lt;br&gt;
one nearest the surface, in whatever file it opens first. It rarely stops to&lt;br&gt;
ask whether the fix addresses the actual requirement, whether a sibling&lt;br&gt;
caller has the same problem, or whether the change is something a reviewer&lt;br&gt;
would sign off on before it ships. That's not a model failure so much as a&lt;br&gt;
missing process: humans don't skip design and review because we're smarter&lt;br&gt;
than that in the moment, we skip it because nobody built the discipline into&lt;br&gt;
the loop.&lt;/p&gt;

&lt;p&gt;Wizard is an attempt to build that discipline into the loop — a Claude Code&lt;br&gt;
plugin that turns a single free-text request into a small software team's&lt;br&gt;
worth of process: a business analyst who writes the spec, an architect who&lt;br&gt;
turns it into a task-owned plan, a bench of specialists who each implement&lt;br&gt;
their piece, and a QA lead who renders a final verdict against the plan's&lt;br&gt;
own definition of done. All of it running as Claude Code agents, all of it&lt;br&gt;
gated by you at the two points that matter most.&lt;/p&gt;
&lt;h2&gt;
  
  
  The core idea: spec → plan → code → review, with real stop points
&lt;/h2&gt;

&lt;p&gt;Every plain &lt;code&gt;/wiz &amp;lt;task&amp;gt;&lt;/code&gt; invocation runs through four phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Spec (Blake).&lt;/strong&gt; A business-analyst agent reads the task, queries
whatever knowledge sources are available about your codebase, and writes
a &lt;code&gt;spec.md&lt;/code&gt; — problem, proposed solution, explicit non-goals, risks, and
Given/When/Then acceptance criteria. No implementation detail yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate 1.&lt;/strong&gt; You read the spec and approve, ask for changes, or cancel.
The orchestrator does not proceed without an explicit answer — this
isn't a rhetorical "does this look right?" the model can talk past, it's
a real stop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan (Archie).&lt;/strong&gt; An architect agent turns the approved spec into
&lt;code&gt;plan.md&lt;/code&gt;: a concrete Definition of Done, a file map, and a numbered
task list where each task carries a suggested owner — one of twelve
specialist roles, scored against trigger keywords (&lt;code&gt;.java&lt;/code&gt;/&lt;code&gt;spring&lt;/code&gt; →
the Java developer, &lt;code&gt;CSS&lt;/code&gt;/&lt;code&gt;accessibility&lt;/code&gt; → the UI developer, &lt;code&gt;CVE&lt;/code&gt;/
&lt;code&gt;OWASP&lt;/code&gt; → security, and so on). The orchestrator re-scores every task
itself afterward, deterministically, so owner assignment never depends
on how convincingly the architect argued for a role.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate 2.&lt;/strong&gt; Same approval mechanism, now against the plan's Definition
of Done and finalized task list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code phase.&lt;/strong&gt; Each task gets its own specialist, spawned with the full
spec, the full plan, and one explicit instruction: if the task
contradicts the plan or the actual codebase, don't improvise — report
&lt;code&gt;SPEC_DRIFT&lt;/code&gt; and let a human decide whether the plan or the spec needs to
change. Silent improvisation is exactly the failure mode this whole
pipeline exists to prevent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Final QA (Quinn).&lt;/strong&gt; Once every task is checked off, a QA agent
independently re-verifies the Definition of Done against the actual
repository state — not the task list's checkmarks — and renders
&lt;code&gt;PASS&lt;/code&gt;, &lt;code&gt;CONCERNS&lt;/code&gt;, or &lt;code&gt;FAIL&lt;/code&gt;. A &lt;code&gt;FAIL&lt;/code&gt; reopens exactly the failing
tasks; it doesn't restart the whole pipeline.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a genuine one-liner, &lt;code&gt;/wiz quick &amp;lt;task&amp;gt;&lt;/code&gt; skips all of this: one&lt;br&gt;
knowledge query, one complexity estimate, one specialist, done. The&lt;br&gt;
mandatory pipeline is the default because most tasks aren't one-liners, even&lt;br&gt;
when they look like one at 9pm.&lt;/p&gt;
&lt;h2&gt;
  
  
  Twelve specialists, one routing table
&lt;/h2&gt;

&lt;p&gt;Wizard doesn't have a single "coder" persona — it has an architect, a senior&lt;br&gt;
developer as the generalist fallback, and dedicated specialists for Java,&lt;br&gt;
Angular, React, Python, UI/CSS, DevOps, QA, business analysis, database&lt;br&gt;
work, and security. Routing is keyword-scored against one fixed trigger&lt;br&gt;
table, shared by the quick-mode router and the plan phase's task-owner&lt;br&gt;
assignment — a task never gets routed one way in one mode and a different&lt;br&gt;
way in another:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Triggers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;architect&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;design, architecture, how should we, system, trade-off, ADR, strategy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;seniorDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;implement, refactor, review, PR, pull request, code review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;javaDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.java&lt;/code&gt;, spring, springboot, maven, gradle, hibernate, JPA, &lt;code&gt;@Bean&lt;/code&gt;, &lt;code&gt;@Service&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;angularDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.component.ts&lt;/code&gt;, &lt;code&gt;.module.ts&lt;/code&gt;, angular, &lt;code&gt;@Component&lt;/code&gt;, &lt;code&gt;@NgModule&lt;/code&gt;, rxjs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uiDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CSS, SCSS, HTML, template, styling, layout, accessibility, Tailwind&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;reactDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;react, jsx, tsx, &lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt;, Next.js, hook&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pythonDev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.py&lt;/code&gt;, django, fastapi, flask, pytest, pandas, pip&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;devops&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dockerfile, k8s, pipeline, CI, CD, Helm, Terraform, kubectl, yaml&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;qa&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;test, spec, assertion, bug, regression, JUnit, Jest, coverage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ba&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;requirement, user story, acceptance criteria, business rule, stakeholder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dba&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SQL, schema, migration, index, stored procedure, Flyway, Liquibase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;securityEng&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;vulnerability, CVE, OWASP, auth, token, injection, XSS, pentest&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Ties resolve &lt;code&gt;architect&lt;/code&gt; &amp;gt; &lt;code&gt;seniorDev&lt;/code&gt; &amp;gt; any specialist; nothing matching&lt;br&gt;
falls back to &lt;code&gt;seniorDev&lt;/code&gt;. It's a small detail, but it's the difference&lt;br&gt;
between "an AI wrote this" and "the person who actually knows Spring Boot&lt;br&gt;
wrote this."&lt;/p&gt;
&lt;h2&gt;
  
  
  Context that isn't just "paste the file"
&lt;/h2&gt;

&lt;p&gt;Before any routing decision, Wizard queries a layered knowledge pipeline:&lt;br&gt;
a pure-Java unified index (LuceneDb) covering both documentation and code&lt;br&gt;
structure, falling back to a graphify code graph if the index hasn't been&lt;br&gt;
built yet, plus a relational knowledge graph for typed entity relationships,&lt;br&gt;
merged and weighted into a single context block. If none of that is&lt;br&gt;
available, it falls back to a plain grep. The point isn't sophistication for&lt;br&gt;
its own sake — it's that a spec written with zero awareness of the existing&lt;br&gt;
codebase is a spec that will drift the moment implementation starts.&lt;/p&gt;

&lt;p&gt;The merge logic itself is a short, readable cascade — each source is tried&lt;br&gt;
in priority order, and only contributes if it actually returns something:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_summary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;working_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Run all enabled knowledge sources and return a merged context string.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="n"&gt;wd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;working_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;budget&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;maxContextTokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_DEFAULT_BUDGET&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;_DEFAULT_WEIGHTS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weights&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})}&lt;/span&gt;
    &lt;span class="n"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;  &lt;span class="c1"&gt;# (source_name, content, weight)
&lt;/span&gt;
    &lt;span class="c1"&gt;# Source 0: LuceneDb — preferred when built, no Node/npm/network needed.
&lt;/span&gt;    &lt;span class="n"&gt;lucenedb_used&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lucenedb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{}).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enabled&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;_lucenedb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;available&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_lucenedb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_summary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lucenedb_index_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lucenedb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;graph&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;qmd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
            &lt;span class="n"&gt;lucenedb_used&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

    &lt;span class="c1"&gt;# Source 1: graphify code graph — automatic fallback if LuceneDb isn't built.
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;lucenedb_used&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;_graphify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;available&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;graph_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;graph_budget&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;budget&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;graph&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_graphify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_summary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;graph_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;budget&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;graph_budget&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;graphify&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;graph&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;

    &lt;span class="c1"&gt;# Source 2: relational knowledge graph — typed entity links.
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;rel_cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enabled&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;_relational&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;available&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rel_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;rel_budget&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;budget&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;relational&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;edges&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_relational&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;_extract_terms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_summary&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;rel_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;formatted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_relational&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format_results&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;budget_chars&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;rel_budget&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;formatted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;knowledge-graph&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formatted&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;relational&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;

    &lt;span class="c1"&gt;# Last resort: plain grep, no index required at all.
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;grep_results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;_grep_fallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_summary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fallbackGlob&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**/*.{md,txt,java,ts,py}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;grep_results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;grep&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grep_results&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;knowledge_context source=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;/knowledge_context&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No index built yet on a brand-new checkout? You still get grep results.&lt;br&gt;
LuceneDb built? It wins by default weight. Nothing ever hard-fails just&lt;br&gt;
because one source isn't available.&lt;/p&gt;
&lt;h2&gt;
  
  
  A case study in eating your own dog food
&lt;/h2&gt;

&lt;p&gt;This plugin was itself repackaged out of an older, looser setup: a skill&lt;br&gt;
file under &lt;code&gt;~/.claude/skills/wizard&lt;/code&gt;, a folder of agent definitions, and a&lt;br&gt;
standalone Python &lt;code&gt;wizard&lt;/code&gt; repo that supplied the knowledge-retrieval code.&lt;br&gt;
The repackaging was supposed to make the plugin fully self-contained —&lt;br&gt;
install it, and it runs, no sibling repo required.&lt;/p&gt;

&lt;p&gt;It didn't, quite. A routing exercise (asking Wizard itself, in quick mode,&lt;br&gt;
whether the new plugin would work without the old repo present) turned up&lt;br&gt;
three separate breakages, each more interesting than the last:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A stale absolute path.&lt;/strong&gt; The plugin's knowledge-query step had a path
hardcoded that didn't exist on the machine in question at all, because the
source repo had since moved:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;  - sys.path.insert(0, 'C:/projects/wizard')
  + sys.path.insert(0, r'${CLAUDE_PLUGIN_ROOT}/scripts/wizard')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Wrong in two ways at once: pointing outside the plugin, &lt;em&gt;and&lt;/em&gt; pointing at&lt;br&gt;
  a location that was already gone. &lt;code&gt;${CLAUDE_PLUGIN_ROOT}&lt;/code&gt; — the same&lt;br&gt;
  variable the plugin's other scripts already used correctly — resolves&lt;br&gt;
  inside the plugin's own install directory, wherever that happens to be.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;An install script referencing the wrong folder name.&lt;/strong&gt; The skill had
been renamed from &lt;code&gt;skills/wizard/&lt;/code&gt; to &lt;code&gt;skills/wiz/&lt;/code&gt; during the
repackaging, but &lt;code&gt;install.sh&lt;/code&gt; still copied from the old name:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;  - cp "$REPO_DIR/skills/wizard/SKILL.md" "$SKILLS_DIR/wizard/SKILL.md"
  + cp "$REPO_DIR/skills/wiz/SKILL.md" "$SKILLS_DIR/wizard/SKILL.md"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It would have failed the moment anyone actually ran it. The same script&lt;br&gt;
  also checked for top-level &lt;code&gt;knowledge/&lt;/code&gt;, &lt;code&gt;retrieval/&lt;/code&gt;, &lt;code&gt;wizard/&lt;/code&gt;&lt;br&gt;
  directories that no longer existed at that level — they'd been nested&lt;br&gt;
  under &lt;code&gt;scripts/wizard/&lt;/code&gt; during the repackaging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;  - if [ -d "$REPO_DIR/knowledge" ] &amp;amp;&amp;amp; [ -d "$REPO_DIR/retrieval" ] &amp;amp;&amp;amp; [ -d "$REPO_DIR/wizard" ]; then
  -   ln -sfn "$REPO_DIR/knowledge" "$WIZARD_LIB_DIR/knowledge"
  -   ln -sfn "$REPO_DIR/retrieval" "$WIZARD_LIB_DIR/retrieval"
  -   ln -sfn "$REPO_DIR/wizard" "$WIZARD_LIB_DIR/wizard"
  + if [ -d "$REPO_DIR/scripts/wizard/config" ] &amp;amp;&amp;amp; [ -d "$REPO_DIR/scripts/wizard/retrieval" ] &amp;amp;&amp;amp; [ -d "$REPO_DIR/scripts/wizard/wizard" ]; then
  +   ln -sfn "$REPO_DIR/scripts/wizard/config" "$WIZARD_LIB_DIR/config"
  +   ln -sfn "$REPO_DIR/scripts/wizard/retrieval" "$WIZARD_LIB_DIR/retrieval"
  +   ln -sfn "$REPO_DIR/scripts/wizard/wizard" "$WIZARD_LIB_DIR/wizard"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Silent, not loud: the original condition just evaluated false and skipped&lt;br&gt;
  the block, so &lt;code&gt;install.sh&lt;/code&gt; never actually crashed — it just quietly never&lt;br&gt;
  linked the knowledge modules it advertised, which is arguably worse than&lt;br&gt;
  a hard failure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A missing package, not just a missing path.&lt;/strong&gt; The deepest issue:
&lt;code&gt;retrieval/unified.py&lt;/code&gt; imports &lt;code&gt;retrieval/relational.py&lt;/code&gt; unconditionally
at module load —
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;graphify&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;_graphify&lt;/span&gt;
  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;lucenedb&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;_lucenedb&lt;/span&gt;
  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;relational&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;_relational&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;— and &lt;code&gt;relational.py&lt;/code&gt; needs a &lt;code&gt;KnowledgeGraph&lt;/code&gt; class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;..knowledge.graph&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;KnowledgeGraph&lt;/span&gt;
  &lt;span class="nf"&gt;except &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;ImportError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;knowledge.graph&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;KnowledgeGraph&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both branches assume a &lt;code&gt;knowledge&lt;/code&gt; package sits somewhere reachable — as&lt;br&gt;
  a parent-package sibling, or as a top-level package on &lt;code&gt;sys.path&lt;/code&gt;. Neither&lt;br&gt;
  was true: the entire &lt;code&gt;knowledge/&lt;/code&gt; directory (&lt;code&gt;graph.py&lt;/code&gt;, &lt;code&gt;extractor.py&lt;/code&gt;,&lt;br&gt;
  &lt;code&gt;build.py&lt;/code&gt;, five files total) had simply never been copied into the&lt;br&gt;
  plugin's bundled Python tree during the carve-out. Fixing the path alone&lt;br&gt;
  would have traded one &lt;code&gt;ModuleNotFoundError&lt;/code&gt; for another the instant&lt;br&gt;
  anything tried to import &lt;code&gt;retrieval.unified&lt;/code&gt;. The fix required going back&lt;br&gt;
  to the original repo, confirming the missing package had no further&lt;br&gt;
  hidden dependencies of its own (a quick grep for its imports — only&lt;br&gt;
  &lt;code&gt;pathlib&lt;/code&gt;, &lt;code&gt;re&lt;/code&gt;, &lt;code&gt;json&lt;/code&gt;, &lt;code&gt;dataclasses&lt;/code&gt;, and its own relative imports came&lt;br&gt;
  back), and copying it in as a sibling of the packages that were already&lt;br&gt;
  there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  scripts/wizard/
  ├── config/
  ├── retrieval/
  ├── wizard/
  └── knowledge/   &amp;lt;- added: graph.py, extractor.py, build.py, __init__.py, __main__.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The lesson generalizes past this one plugin: "it imports correctly" and "the&lt;br&gt;
path string points somewhere plausible" are different claims, and only one&lt;br&gt;
of them is verifiable by reading the text of the code. The other one you&lt;br&gt;
have to actually trace, import by import, or run.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--plugin-dir&lt;/span&gt; /path/to/wizard-plugin
/wizard:wiz setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;setup&lt;/code&gt; walks through working directory, model tier preferences, and which&lt;br&gt;
specialist roles you want enabled. After that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/wizard:wiz &amp;lt;task&amp;gt;          &lt;span class="c"&gt;# the full spec -&amp;gt; plan -&amp;gt; code -&amp;gt; review pipeline&lt;/span&gt;
/wizard:wiz quick &amp;lt;task&amp;gt;    &lt;span class="c"&gt;# skip the gates for a genuine one-liner&lt;/span&gt;
/wizard:wiz knowledge status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runtime configuration lives at &lt;code&gt;~/.wizard/config.json&lt;/code&gt;, outside the plugin&lt;br&gt;
itself, so upgrading the plugin never touches your working-directory or&lt;br&gt;
model-tier preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why bother with all this ceremony
&lt;/h2&gt;

&lt;p&gt;Because the ceremony is the point. A model that writes code without a spec&lt;br&gt;
will happily write code that solves the wrong problem, quickly and&lt;br&gt;
confidently. A model that writes code without a plan will happily improvise&lt;br&gt;
around a codebase constraint it hasn't actually checked. A model that grades&lt;br&gt;
its own homework will mark it correct. Wizard doesn't make Claude smarter —&lt;br&gt;
it makes the &lt;em&gt;process&lt;/em&gt; harder to shortcut, which turns out to matter more.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Lucene V/S KQL</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Thu, 01 May 2025 14:20:10 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/lucene-vs-kql-206b</link>
      <guid>https://dev.to/mallikarjunht/lucene-vs-kql-206b</guid>
      <description>&lt;h2&gt;
  
  
  A Tour of  KQL  vs  Lucene
&lt;/h2&gt;

&lt;p&gt;Elasticsearch is a search engine, and Kibana can be used to search documents in Elasticsearch.&lt;br&gt;
A search is executed by sending a query to Elasticsearch. A query can answer many different types of questions. &lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Who are the customers with the first name Edison?&lt;br&gt;
What are the names of customers in India?&lt;br&gt;
Are there any orders for Men’s Clothing OR Electronics section?&lt;/p&gt;
&lt;h2&gt;
  
  
  Should I use  KQL  or  Lucene  in the Kibana query bar?
&lt;/h2&gt;

&lt;p&gt;It Depends, Both KQL and Lucine have a quite a lot in common.&lt;br&gt;
I recoment to start with KQL then switch to Lucine for Specific Aggrigation use Case.&lt;/p&gt;
&lt;h2&gt;
  
  
  Learn By Executing.
&lt;/h2&gt;

&lt;p&gt;in order to learn use the Free trial or download the pre prepared data sets to run locally if cloud trial expires.&lt;/p&gt;
&lt;h2&gt;
  
  
  KQL Features.
&lt;/h2&gt;

&lt;p&gt;once you load your data you can use kibana to explore and learn about the features.&lt;/p&gt;

&lt;p&gt;NOTE: KQL is case in sencitive and Lucine operaters are All Caps only&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Autocomplete - KQL&lt;/li&gt;
&lt;li&gt;Full Testsearch - KQL and Lucine&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Exact Match
&lt;/h2&gt;

&lt;p&gt;You can search for documents that contain an exact term in a provided field of data type keyword(opens in a new tab), which will not be analyzed. Not analyzed strings are case sensitive.&lt;/p&gt;

&lt;p&gt;Example:  Customer_first_name.keyword: Elyssa &lt;/p&gt;

&lt;p&gt;Note: keyword is a type that only supports Exact search, if not given while searching then anything close to the word is returned.&lt;/p&gt;
&lt;h2&gt;
  
  
  Phrase search
&lt;/h2&gt;

&lt;p&gt;To search text fields where the search terms are in the order provided, surround the value in double quotation marks, as follows:&lt;/p&gt;

&lt;p&gt;Example:  “Elyssa Underwood” - this is all field search&lt;br&gt;
Example:  Customer_full_name: “Elyssa Underwood”  - this ia field specific search&lt;/p&gt;
&lt;h2&gt;
  
  
  Fuzzy Search only available in Lucine
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;arjun~1 - will match any word with 1ch differance, the number determines the no of charecters that can differ&lt;/li&gt;
&lt;li&gt;arj*n - whild charecter search one or more charecters can occur in between arj and n&lt;/li&gt;
&lt;li&gt;arj?n - single charecter only&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NOTE: bad idea to use &lt;code&gt;**&lt;/code&gt; or &lt;code&gt;?*&lt;/code&gt; as this can cause perfomance issues.&lt;br&gt;
to allow change the settings in elastic search.&lt;/p&gt;
&lt;h2&gt;
  
  
  Regex
&lt;/h2&gt;

&lt;p&gt;A regular expression is a way to match patterns in data using placeholder characters called operators. It returns documents that contain terms matching a regular expression. Syntax is based on the &lt;em&gt;Lucene regular expression&lt;/em&gt; engine.&lt;/p&gt;

&lt;p&gt;Example:  /.&lt;em&gt;+91[0-9]{9}.&lt;/em&gt;/ &lt;/p&gt;

&lt;p&gt;this will match number with &lt;code&gt;+91 xxx xxx xxx&lt;/code&gt; &lt;/p&gt;
&lt;h2&gt;
  
  
  Ranges
&lt;/h2&gt;

&lt;p&gt;To search documents that contain terms within a provided range, use KQL’s &lt;a href="https://www.elastic.co/docs/explore-analyze/query-filter/languages/kql#_filter_for_documents_within_a_range" rel="noopener noreferrer"&gt;range syntax&lt;/a&gt;. You can use the range syntax for string values, IP addresses, and timestamps.&lt;/p&gt;

&lt;p&gt;KQL Supports the following syntax &lt;code&gt;&amp;gt;, &amp;gt;=, &amp;lt;, and &amp;lt;=&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Lucene  supports bracketed &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/8.5/query-dsl-query-string-query.html#_ranges" rel="noopener noreferrer"&gt;range syntax&lt;/a&gt;. Ranges can be specified for date, numeric or string fields. Inclusive ranges are specified with square brackets [min TO max] and exclusive ranges with curly brackets {min TO max}.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; date:[2012-01-01 TO 2012-12-31]
 count:[1 TO 5]
 tag:{alpha TO omega}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;## Proximity Search&lt;br&gt;
 &lt;strong&gt;Lucine Exclusive&lt;/strong&gt;&lt;br&gt;
 Proximity search(opens in a new tab) allows the specified words to be further apart or in a different order, a proximity search allows us to specify a maximum edit distance of words in a phrase. The closer the text in a field is to the original order specified in the query string, the more relevant that document is considered to be&lt;/p&gt;

&lt;p&gt;“open data”~1 &lt;/p&gt;

&lt;p&gt;The above example will find all the documents where “open data” is found as a phrase and also “open source data” is a hit where one more term is present in between open and data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Boosting
&lt;/h2&gt;

&lt;p&gt;Lucene &lt;/p&gt;

&lt;p&gt;Use the boost operator ^ to make one term more relevant than another. For instance, if we want to find all documents about foxes, but we are especially interested in quick foxes:&lt;/p&gt;

&lt;p&gt;quick^2 fox &lt;/p&gt;

&lt;p&gt;The default boost value is 1, but can be any positive floating point number. Boosts between 0 and 1 reduce relevance.&lt;/p&gt;

&lt;p&gt;Boosts can also be applied to phrases or to groups:&lt;/p&gt;

&lt;p&gt;"john smith"^2   (foo bar)^4&lt;/p&gt;

&lt;h2&gt;
  
  
  Searching for IP addresses
&lt;/h2&gt;

&lt;p&gt;KQL   Lucene  &lt;/p&gt;

&lt;p&gt;Use  ""  around IP addresses while using Lucene syntax. &lt;br&gt;
Lucene also supports CIDR notation.&lt;/p&gt;

&lt;p&gt;Example:  "192.168.03.01" &lt;/p&gt;

&lt;h2&gt;
  
  
  Nested fields
&lt;/h2&gt;

&lt;p&gt;KQL &lt;/p&gt;

&lt;p&gt;Querying nested fields requires a special syntax. &lt;/p&gt;

&lt;p&gt;Example:  user.names:{ first: "Alyssa" and last: "Underwood" } &lt;/p&gt;

&lt;h2&gt;
  
  
  Runtime fields
&lt;/h2&gt;

&lt;p&gt;KQL    Lucene &lt;/p&gt;

&lt;p&gt;A runtime field is a field that is evaluated at query time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzkh5zbp2y6k59okcc51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzkh5zbp2y6k59okcc51.png" alt="Image description" width="691" height="821"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>lucene</category>
      <category>opensource</category>
      <category>elasticsearch</category>
      <category>kibana</category>
    </item>
    <item>
      <title>KQL and syntex</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Wed, 23 Apr 2025 14:07:07 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/kql-and-syntex-3jjo</link>
      <guid>https://dev.to/mallikarjunht/kql-and-syntex-3jjo</guid>
      <description>&lt;h3&gt;
  
  
  Should I use  KQL  or  Lucene  in the Kibana query bar?
&lt;/h3&gt;

&lt;p&gt;It depends! KQL and Lucene have quite a lot in common, but there are some differences. Let's explore some key-features one by one to find out the best use-case for each language.&lt;/p&gt;

&lt;p&gt;For new users, we recommend starting with KQL(opens in a new tab) and switching to Lucene(opens in a new tab) if any particular feature is unavailable in KQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  KQL
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Kibana Query Language (KQL) is a simple text-based query language for filtering data.&lt;/li&gt;
&lt;li&gt;KQL only filters data, and has no role in aggregating, transforming, or sorting data.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Semi-structured search
&lt;/h2&gt;

&lt;p&gt;free text search with field-based search.&lt;/p&gt;

&lt;p&gt;The semi-structured search will filter documents for matches, and only return matching documents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95tt1ryrgf4teo7zey7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95tt1ryrgf4teo7zey7s.png" alt="KQL querry" width="729" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter for documents where a field exists
&lt;/h2&gt;

&lt;p&gt;To filter documents for which an indexed value exists for a given field, use the * operator. &lt;/p&gt;

&lt;p&gt;For example, to filter for documents where the http.request.method field exists, use the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;http.request.method: *&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This checks for any indexed value, including an empty string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter for documents that match a value
&lt;/h2&gt;

&lt;p&gt;Use KQL to filter for documents that match a specific number, text, date, or boolean value. For example, to filter for documents where the http.request.method is GET, use the following query:&lt;br&gt;
&lt;code&gt;http.request.method: GET&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to search all fields for “Hello”, use the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Hello&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To  querying keyword, numeric, date, or boolean fields, the value must be an exact match, including punctuation and case.&lt;/p&gt;

&lt;p&gt;To Search text field that has "null pointer" then querry using &lt;code&gt;http.request.body.content: "null pointer"&lt;/code&gt; if the &lt;code&gt;\"&lt;/code&gt; are not used then you will get all documents that has &lt;code&gt;null pointer&lt;/code&gt; OR &lt;code&gt;Pointer null&lt;/code&gt;. This is called term querry.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;to search urls use &lt;code&gt;\&lt;/code&gt; or you will find syntax error OR try with &lt;code&gt;"&lt;/code&gt;.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http.request.referrer: "https://example.com"  
http.request.referrer: https\://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;[!Note] &lt;br&gt;
&lt;code&gt;\():&amp;lt;&amp;gt;"*&lt;/code&gt; excape These Charecters with &lt;code&gt;\&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Filter for documents within a range
&lt;/h2&gt;

&lt;p&gt;to search for all documents for which http.response.bytes is less than 10000, use the following syntax:&lt;br&gt;
&lt;code&gt;http.response.bytes &amp;lt; 10000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to search In Range use this&lt;br&gt;
&lt;code&gt;http.response.bytes &amp;gt; 10000 and http.response.bytes &amp;lt;= 20000&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter for documents using wildcards
&lt;/h2&gt;

&lt;p&gt;To search for documents matching a pattern, use the wildcard syntax. For example, to find documents where http.response.status_code begins with a 4, use the following syntax:&lt;/p&gt;

&lt;p&gt;http.response.status_code: 4*&lt;br&gt;
By default, leading wildcards are not allowed for performance reasons. You can modify this with the query:allowLeadingWildcards advanced setting.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[!Note]&lt;br&gt;
Only * is currently supported. This matches zero or more characters.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Negating a query
&lt;/h2&gt;

&lt;p&gt;use &lt;strong&gt;NOT&lt;/strong&gt; in front of querry like:&lt;br&gt;
&lt;code&gt;NOT http.request.method: GET&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Querying nested fields
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;.&lt;/code&gt; operater to query nested fields like:&lt;br&gt;
&lt;code&gt;user.names:{ first: "Alice" and last: "White" }&lt;/code&gt;&lt;/p&gt;

</description>
      <category>elk</category>
      <category>elasticsearch</category>
      <category>kql</category>
    </item>
    <item>
      <title>Installing Elastic Search 7.14 with docker</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Tue, 10 Sep 2024 04:52:53 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/installing-elastic-search-714-with-docker-4edn</link>
      <guid>https://dev.to/mallikarjunht/installing-elastic-search-714-with-docker-4edn</guid>
      <description>&lt;p&gt;Welcome to the ultimate guide on Elastic Search and Kibana! If you're looking for a powerful, open-source tool that can help you search, analyze, and visualize your data like never before, then look no further. In this comprehensive guide, we'll take you through everything you need to know about Elastic Search and Kibana - from what they are and how they work together to their installation with Docker. Whether you're a developer or just getting started with these tools, get ready to learn everything there is to know about using Elastic Search and Kibana with Docker in this exciting blog post!&lt;/p&gt;

&lt;h4&gt;
  
  
  Introduction to Elasticsearch and Kibana
&lt;/h4&gt;

&lt;p&gt;Elasticsearch is a powerful open source search and analytics engine that makes data easy to explore. Kibana is an open source data visualization platform that allows you to interact with your data through beautiful visualizations. In this guide, we'll show you how to use Docker to install and run Elasticsearch and Kibana on your local machine.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Elastic Search?
&lt;/h4&gt;

&lt;p&gt;Elastic Search is a powerful, open source, distributed search and analytics engine. It is built on top of the Apache Lucene search library and supports full text search, as well as structured data search with SQL-like query syntax. Elastic Search can be used to power search for websites, applications, and enterprise search solutions. It is also commonly used for log analysis, monitoring, and security analytics.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Kibana?
&lt;/h4&gt;

&lt;p&gt;Kibana is an open source data visualization plugin for the Elasticsearch stack. It provides a rich set of tools to help you visualize and explore your data in Elasticsearch. Kibana is a great way to get started with visualizing your data in Elasticsearch.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Install Elastic Search and Kibana with Docker
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2.2'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;node01&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.elastic.co/elasticsearch/elasticsearch:7.14.1&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node01&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;node.name=node01&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;cluster.name=es-my-cluster&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;discovery.type=single-node&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;bootstrap.memory_lock=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ES_JAVA_OPTS=-Xms512m&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-Xmx512m"&lt;/span&gt;
    &lt;span class="na"&gt;ulimits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;memlock&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;soft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;-1&lt;/span&gt;
        &lt;span class="na"&gt;hard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;-1&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;data01:/usr/share/elasticsearch/data&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;9200:9200&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;elastic&lt;/span&gt;
  &lt;span class="na"&gt;kib01test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.elastic.co/kibana/kibana:7.14.1&lt;/span&gt;
    &lt;span class="na"&gt;container_name &lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kib01test&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ELASTICSEARCH_HOSTS=http://node01:9200&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;5601:5601&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;elastic&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;data01&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local&lt;/span&gt;

&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;elastic&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bridge&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>elasticsearch</category>
      <category>elk</category>
      <category>kibana</category>
      <category>docker</category>
    </item>
    <item>
      <title>ES - Node APIs</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Tue, 13 Aug 2024 09:40:44 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-node-apis-4fdk</link>
      <guid>https://dev.to/mallikarjunht/es-node-apis-4fdk</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# If no filters are given, the default is to select all nodes
curl -X GET "localhost:9200/_nodes?pretty"
# Explicitly select all nodes
curl -X GET "localhost:9200/_nodes/_all?pretty"
# Select just the local node
curl -X GET "localhost:9200/_nodes/_local?pretty"
# Select the elected master node
curl -X GET "localhost:9200/_nodes/_master?pretty"
# Select nodes by name, which can include wildcards
curl -X GET "localhost:9200/_nodes/node_name_goes_here?pretty"
curl -X GET "localhost:9200/_nodes/node_name_goes_*?pretty"
# Select nodes by address, which can include wildcards
curl -X GET "localhost:9200/_nodes/10.0.0.3,10.0.0.4?pretty"
curl -X GET "localhost:9200/_nodes/10.0.0.*?pretty"
# Select nodes by role
curl -X GET "localhost:9200/_nodes/_all,master:false?pretty"
curl -X GET "localhost:9200/_nodes/data:true,ingest:true?pretty"
curl -X GET "localhost:9200/_nodes/coordinating_only:true?pretty"
# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
curl -X GET "localhost:9200/_nodes/rack:2?pretty"
curl -X GET "localhost:9200/_nodes/ra*:2?pretty"
curl -X GET "localhost:9200/_nodes/ra*:2*?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>ES - CAT APIs</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Tue, 13 Aug 2024 09:38:43 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-cat-apis-ilp</link>
      <guid>https://dev.to/mallikarjunht/es-cat-apis-ilp</guid>
      <description>&lt;h3&gt;
  
  
  cat APIs
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;All the cat commands accept a query string parameter help to see all the headers and info they provide, and the /_cat command alone lists all the available commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common parameters
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Verbose - &lt;code&gt;curl -X GET "localhost:9200/_cat/master?v&amp;amp;pretty"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Help - &lt;code&gt;curl -X GET "localhost:9200/_cat/master?help&amp;amp;pretty"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Headers - &lt;code&gt;curl -X GET "localhost:9200/_cat/nodes?h=ip,port,heapPercent,name&amp;amp;pretty"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Numeric formats - &lt;code&gt;curl 'localhost:9200/_cat/indices?bytes=b' | sort -rnk8&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Response as text, json, smile, yaml or cbor - &lt;code&gt;curl 'localhost:9200/_cat/indices?format=json&amp;amp;pretty'&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Sort - &lt;code&gt;curl -X GET "localhost:9200/_cat/templates?v&amp;amp;s=order:desc,index_patterns&amp;amp;pretty"&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  cat aliases
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/aliases?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat allocation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/allocation?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat count
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/count?v&amp;amp;pretty"

curl -X GET "localhost:9200/_cat/count/twitter?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat fielddata
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/fielddata?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat health
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/health?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat indices
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/indices?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply Filter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/indices/twi*?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat un healthy index
&lt;/h3&gt;

&lt;p&gt;indices which are not ready&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/indices?v&amp;amp;health=yellow&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;sort by dock count&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/indices?v&amp;amp;s=docs.count:desc&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat master
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/master?v&amp;amp;pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat nodes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/nodes?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.4/cat-nodes.html" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  cat pending tasks
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/pending_tasks?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat plugins
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/plugins?v&amp;amp;s=component&amp;amp;h=name,component,version,description&amp;amp;pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat recovery
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/recovery?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat repositories
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/repositories?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  cat thread pool
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/thread_pool?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for field data visit &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.4/cat-thread-pool.html" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  cat shards
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/shards?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reasion for un assigned shared look &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.4/cat-shards.html" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;INDEX_CREATED | Unassigned as a result of an API creation of an index.&lt;/p&gt;

&lt;p&gt;CLUSTER_RECOVERED | Unassigned as a result of a full cluster recovery.&lt;/p&gt;

&lt;p&gt;INDEX_REOPENED | Unassigned as a result of opening a closed index.&lt;/p&gt;

&lt;p&gt;DANGLING_INDEX_IMPORTED | Unassigned as a result of importing a dangling index.&lt;/p&gt;

&lt;p&gt;NEW_INDEX_RESTORED | Unassigned as a result of restoring into a new index.&lt;/p&gt;

&lt;p&gt;EXISTING_INDEX_RESTORED | Unassigned as a result of restoring into a closed index.&lt;/p&gt;

&lt;p&gt;REPLICA_ADDED | Unassigned as a result of explicit addition of a replica.&lt;/p&gt;

&lt;p&gt;ALLOCATION_FAILED | Unassigned as a result of a failed allocation of the shard.&lt;/p&gt;

&lt;p&gt;NODE_LEFT | Unassigned as a result of the node hosting it leaving the cluster.&lt;/p&gt;

&lt;p&gt;REROUTE_CANCELLED | Unassigned as a result of explicit cancel reroute command.&lt;/p&gt;

&lt;p&gt;REINITIALIZED | When a shard moves from started back to initializing, for example, with shadow replicas.&lt;/p&gt;

&lt;p&gt;REALLOCATED_REPLICA | A better replica location is identified and causes the existing replica allocation to be cancelled. &lt;/p&gt;

&lt;h3&gt;
  
  
  cat segments
&lt;/h3&gt;

&lt;p&gt;this where your data is saved on the FS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/segments?v&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  snapshots
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/snapshots/repo1?v&amp;amp;s=id&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  templates
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_cat/templates?v&amp;amp;s=name&amp;amp;pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>elasticsearch</category>
      <category>kibana</category>
      <category>nosql</category>
      <category>elk</category>
    </item>
    <item>
      <title>ES - Index API - part 4</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Mon, 05 Aug 2024 08:04:39 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-index-api-part-4-3ech</link>
      <guid>https://dev.to/mallikarjunht/es-index-api-part-4-3ech</guid>
      <description>&lt;h3&gt;
  
  
  Indices Stats
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_stats?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Indices Segments
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/test/_segments?pretty"

curl -X GET "localhost:9200/test/_segments?verbose=true&amp;amp;pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Indices Recovery
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/_recovery?human&amp;amp;pretty"

curl -X GET "localhost:9200/_recovery?human&amp;amp;detailed=true&amp;amp;pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Indices Shard Stores
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# return information of only index test
curl -X GET "localhost:9200/test/_shard_stores?pretty"
# return information of only test1 and test2 indices
curl -X GET "localhost:9200/test1,test2/_shard_stores?pretty"
# return information of all indices
curl -X GET "localhost:9200/_shard_stores?pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Clear Cache
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/twitter/_cache/clear?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flush
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/twitter/_flush?pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Synced Flush
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/twitter/_flush/synced?pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Refresh
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/twitter/_refresh?pretty"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Force Merge
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/twitter/_forcemerge?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>ES Index API - part 3</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Mon, 05 Aug 2024 07:47:49 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-index-api-part-3-1i76</link>
      <guid>https://dev.to/mallikarjunht/es-index-api-part-3-1i76</guid>
      <description>&lt;h3&gt;
  
  
  PUT Mappings
&lt;/h3&gt;

&lt;h4&gt;
  
  
  create index with mappings
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/twitter?pretty" -H 'Content-Type: application/json' -d'
{}'

curl -X PUT "localhost:9200/twitter/_mapping/_doc?pretty" -H 'Content-Type: application/json' -d'
{
  "properties": {
    "email": {
      "type": "keyword"
    }
  }
}'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  update existing index
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/my_index?pretty" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "_doc": {
      "properties": {
        "name": {
          "properties": {
            "first": {
              "type": "text"
            }
          }
        },
        "user_id": {
          "type": "keyword"
        }
      }
    }
  }
}'

curl -X PUT "localhost:9200/my_index/_mapping/_doc?pretty" -H 'Content-Type: application/json' -d'
{
  "properties": {
    "name": {
      "properties": {
        "last": { 
          "type": "text"
        }
      }
    },
    "user_id": {
      "type": "keyword",
      "ignore_above": 100 
    }
  }
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Get Mappings
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/twitter/_mapping/_doc?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  GET field mapping
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/publications/_mapping/_doc/field/title?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>ES Index API- part 2</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Mon, 05 Aug 2024 07:33:31 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-index-api-part-2-3pmj</link>
      <guid>https://dev.to/mallikarjunht/es-index-api-part-2-3pmj</guid>
      <description>&lt;h3&gt;
  
  
  Delete Index
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X DELETE "localhost:9200/twitter?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Get Index
&lt;/h3&gt;

&lt;p&gt;this will return mappings and settings if index exist&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET "localhost:9200/twitter?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  check if index exist
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -I "localhost:9200/twitter?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Open / Close Index API
&lt;/h3&gt;

&lt;p&gt;use this with caution - like updating or to prevent new document insertion - search will work but indexing will not work&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/my_index/_close?pretty"
curl -X POST "localhost:9200/my_index/_open?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Shrink Index
&lt;/h3&gt;

&lt;p&gt;use this to reduce the number of shards for version &amp;lt; 7 it is 5 and above it is 1 shard.&lt;/p&gt;

&lt;h4&gt;
  
  
  Preparing an index for shrinking
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/my_source_index/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "index.routing.allocation.require._name": "shrink_node_name", 
    "index.blocks.write": true 
  }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Shrinking an index
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/my_source_index/_shrink/my_target_index?copy_settings=true&amp;amp;pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "index.routing.allocation.require._name": null, 
    "index.blocks.write": null 
  }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Shrinking with settings
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "localhost:9200/my_source_index/_shrink/my_target_index?copy_settings=true&amp;amp;pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "index.number_of_replicas": 1,
    "index.number_of_shards": 1, 
    "index.codec": "best_compression" 
  },
  "aliases": {
    "my_search_indices": {}
  }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Rollover Index
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Defining the new index
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/logs-000001?pretty" -H 'Content-Type: application/json' -d'
{
  "aliases": {
    "logs_write": {}
  }
}'

curl -X POST "localhost:9200/logs_write/_rollover?pretty" -H 'Content-Type: application/json' -d'
{
  "conditions" : {
    "max_age": "7d",
    "max_docs": 1000,
    "max_size": "5gb"
  },
  "settings": {
    "index.number_of_shards": 2
  }
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Dry run
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/logs-000001?pretty" -H 'Content-Type: application/json' -d'
{
  "aliases": {
    "logs_write": {}
  }
}'

curl -X POST "localhost:9200/logs_write/_rollover?dry_run&amp;amp;pretty" -H 'Content-Type: application/json' -d'
{
  "conditions" : {
    "max_age": "7d",
    "max_docs": 1000,
    "max_size": "5gb"
  }
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>elasticsearch</category>
      <category>elk</category>
      <category>documentation</category>
      <category>nosql</category>
    </item>
    <item>
      <title>ES index API - part 1</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Mon, 05 Aug 2024 07:13:56 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/es-index-api-part-1-1km2</link>
      <guid>https://dev.to/mallikarjunht/es-index-api-part-1-1km2</guid>
      <description>&lt;h2&gt;
  
  
  Indices APIs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Index management:
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create Index
Delete Index
Get Index
Indices Exists
Open / Close Index API
Shrink Index
Split Index
Rollover Index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;### Mapping management:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Put Mapping
Get Mapping
Get Field Mapping
Types Exists
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Alias management:
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Index Aliases
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Index settings:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Update Indices Settings
Get Settings
Analyze
Index Templates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Monitoring:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Indices Stats
Indices Segments
Indices Recovery
Indices Shard Stores
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Status management:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clear Cache
Refresh
Flush
Force Merge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Create Index
&lt;/h4&gt;

&lt;p&gt;index creation without any mappings&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/twitter?pretty"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: &lt;/p&gt;

&lt;p&gt;Index name limitations&lt;/p&gt;

&lt;p&gt;There are several limitations to what you can name your index. The complete list of limitations are:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lowercase only
Cannot include \, /, *, ?, ", &amp;lt;, &amp;gt;, |, ` ` (space character), ,, #
Indices prior to 7.0 could contain a colon (:), but that’s been deprecated and won’t be supported in 7.0+
Cannot start with -, _, +
Cannot be . or ..
Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters will count towards the 255 limit faster)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Index Settings
&lt;/h4&gt;

&lt;p&gt;To update index use this, in this payload we are setting number of shards and no of replicas&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/twitter?pretty" -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "number_of_shards" : 3,
        "number_of_replicas" : 2
    }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Mappings
&lt;/h4&gt;

&lt;p&gt;setting mappings to an index while creation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/test?pretty" -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "_doc" : {
            "properties" : {
                "field1" : { "type" : "text" }
            }
        }
    }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  setting Aliases on existing index
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
curl -XPUT localhost:9200/index1/_alias/index2&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
multiple Aliases and filtering&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT "localhost:9200/test?pretty" -H 'Content-Type: application/json' -d'
{
    "aliases" : {
        "alias_1" : {},
        "alias_2" : {
            "filter" : {
                "term" : {"user" : "kimchy" }
            },
            "routing" : "kimchy"
        }
    }
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>elasticsearch</category>
      <category>elk</category>
      <category>nosql</category>
      <category>documentation</category>
    </item>
    <item>
      <title>java prep - part 3</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Tue, 18 Jun 2024 02:42:49 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/java-prep-part-3-5c7e</link>
      <guid>https://dev.to/mallikarjunht/java-prep-part-3-5c7e</guid>
      <description>&lt;h3&gt;
  
  
  can we disable the default behaviour of spring explain with example
&lt;/h3&gt;

&lt;p&gt;Yes, in Spring Framework, you can disable or customize default behaviors by overriding configurations or using specific annotations to alter how Spring manages components and processes requests. Let's explore a couple of examples where you might want to disable default behaviors in Spring:&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Disabling Default Spring Security Configuration
&lt;/h3&gt;

&lt;p&gt;By default, Spring Security applies a set of security configurations to your application, including basic authentication and authorization rules. You might want to disable these default behaviors if you have custom security requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-step Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Disable Security Auto-Configuration&lt;/strong&gt;:
To disable Spring Security's default configuration, you can exclude the &lt;code&gt;SecurityAutoConfiguration&lt;/code&gt; class from auto-configuration in your main application class or configuration class.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.SpringApplication&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.autoconfigure.SpringBootApplication&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

   &lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exclude&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;SecurityAutoConfiguration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApplication&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
           &lt;span class="nc"&gt;SpringApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MyApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
       &lt;span class="o"&gt;}&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@SpringBootApplication&lt;/code&gt; is annotated with &lt;code&gt;exclude = {SecurityAutoConfiguration.class}&lt;/code&gt;, which disables Spring Security's auto-configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Customize Security Configuration&lt;/strong&gt;:
After disabling default configuration, you can then customize security settings by creating your own &lt;code&gt;SecurityConfig&lt;/code&gt; class and configuring it based on your specific requirements using &lt;code&gt;@EnableWebSecurity&lt;/code&gt; and extending &lt;code&gt;WebSecurityConfigurerAdapter&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.Configuration&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.security.config.annotation.web.configuration.EnableWebSecurity&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

   &lt;span class="nd"&gt;@Configuration&lt;/span&gt;
   &lt;span class="nd"&gt;@EnableWebSecurity&lt;/span&gt;
   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SecurityConfig&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;WebSecurityConfigurerAdapter&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="nd"&gt;@Override&lt;/span&gt;
       &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpSecurity&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
           &lt;span class="c1"&gt;// Customize your security configuration here&lt;/span&gt;
           &lt;span class="n"&gt;http&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;authorizeRequests&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;antMatchers&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/public/**"&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;permitAll&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;anyRequest&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;authenticated&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;and&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;formLogin&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;loginPage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/login"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;permitAll&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;and&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
               &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;logout&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                   &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;permitAll&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
       &lt;span class="o"&gt;}&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This &lt;code&gt;SecurityConfig&lt;/code&gt; class provides customized security configurations, overriding the default behavior that was disabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Disabling Spring Boot Banner
&lt;/h3&gt;

&lt;p&gt;Spring Boot displays a banner by default during application startup. You may want to disable this banner for specific reasons, such as cleaner log output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-step Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Disable Banner Programmatically&lt;/strong&gt;:
You can disable the banner programmatically by setting &lt;code&gt;spring.main.banner-mode&lt;/code&gt; property to &lt;code&gt;OFF&lt;/code&gt; in your &lt;code&gt;application.properties&lt;/code&gt; or &lt;code&gt;application.yml&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;   &lt;span class="py"&gt;spring.main.banner-mode&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;OFF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration instructs Spring Boot not to display the banner during application startup.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Disable Banner via Configuration Class&lt;/strong&gt;:
Alternatively, you can disable the banner by creating a configuration class and using &lt;code&gt;SpringApplication.setBannerMode(Banner.Mode.OFF)&lt;/code&gt; in your main application class.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.Banner&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.SpringApplication&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.autoconfigure.SpringBootApplication&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

   &lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;
   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApplication&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
           &lt;span class="nc"&gt;SpringApplication&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SpringApplication&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MyApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
           &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setBannerMode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Banner&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Mode&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;OFF&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
           &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
       &lt;span class="o"&gt;}&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;SpringApplication.setBannerMode(Banner.Mode.OFF)&lt;/code&gt; disables the banner explicitly for the &lt;code&gt;MyApplication&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;Spring Framework provides flexibility to disable default behaviors by excluding auto-configurations, overriding configuration classes, or configuring properties. This approach allows developers to customize Spring applications according to specific requirements, ensuring that the framework's default behaviors align with application needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  How caching works with example/ archtecture diagram as code
&lt;/h3&gt;

&lt;p&gt;Caching in software systems, including those built with Spring Boot, involves storing frequently accessed data in a faster access storage to improve performance and reduce load on backend systems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.cache.annotation.Cacheable&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.stereotype.Service&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@Service&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Cacheable&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"usersCache"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"#userId"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="nf"&gt;getUserDetails&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Long&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Simulate fetching user details from a database&lt;/span&gt;
        &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Enable caching
spring.cache.type=ehcache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  with Redis example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.io.Serializable&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Serializable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Getters and setters (omitted for brevity)&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Book{"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                &lt;span class="s"&gt;"isbn='"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sc"&gt;'\''&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                &lt;span class="s"&gt;", title='"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sc"&gt;'\''&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                &lt;span class="s"&gt;", author='"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sc"&gt;'\''&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                &lt;span class="sc"&gt;'}'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.beans.factory.annotation.Autowired&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.data.redis.core.RedisTemplate&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.stereotype.Service&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@Service&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BookService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;REDIS_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"books"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;RedisTemplate&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;redisTemplate&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;saveBook&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="n"&gt;book&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;redisTemplate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;opsForHash&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;REDIS_KEY&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;book&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getIsbn&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;book&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="nf"&gt;getBook&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;redisTemplate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;opsForHash&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;REDIS_KEY&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;deleteBook&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;redisTemplate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;opsForHash&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;delete&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;REDIS_KEY&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isbn&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>java interview prep part 2</title>
      <dc:creator>Mallikarjun H T</dc:creator>
      <pubDate>Tue, 18 Jun 2024 02:25:52 +0000</pubDate>
      <link>https://dev.to/mallikarjunht/java-interview-prep-part-2-300i</link>
      <guid>https://dev.to/mallikarjunht/java-interview-prep-part-2-300i</guid>
      <description>&lt;h3&gt;
  
  
  Explain restcontroller annotation in springboot
&lt;/h3&gt;

&lt;p&gt;In Spring Boot, @RestController is a specialized version of the @Controller annotation. It is used to indicate that the class is a RESTful controller that handles HTTP requests and directly maps them to the methods inside the class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.web.bind.annotation.GetMapping&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.web.bind.annotation.RestController&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@RestController&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloController&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/hello"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purpose of @RestController:&lt;br&gt;
API Endpoint Handling:&lt;/p&gt;

&lt;p&gt;@RestController combines @Controller and @ResponseBody. It is primarily used to create RESTful web services where HTTP requests (GET, POST, PUT, DELETE, etc.) are mapped directly to the methods in the class.&lt;br&gt;
Automatic JSON/XML Conversion:&lt;/p&gt;

&lt;p&gt;Methods in a @RestController return domain objects directly. Spring Boot automatically converts these objects into JSON or XML responses (based on the Accept header of the request) using Jackson or another configured message converter.&lt;br&gt;
Simplification of Controller Code:&lt;/p&gt;

&lt;p&gt;By annotating a class with @RestController, developers can streamline the code as they no longer need to add @ResponseBody to every request handling method.&lt;/p&gt;

&lt;h3&gt;
  
  
  Explain microstructure architecture
&lt;/h3&gt;

&lt;p&gt;Microservices Architecture:&lt;br&gt;
Microservices Architecture is an architectural style that structures an application as a collection of loosely coupled services. Each service is self-contained, independently deployable, and typically focuses on performing a single business function.&lt;/p&gt;

&lt;p&gt;Benefits of Microservices Architecture:&lt;br&gt;
Scalability: Individual microservices can be scaled independently based on demand.&lt;br&gt;
Flexibility and Agility: Enables rapid development, deployment, and updates of services.&lt;br&gt;
Improved Fault Isolation: Failures are contained within a single service, reducing impact on the overall system.&lt;br&gt;
Technology Diversity: Allows for the use of different technologies and frameworks for different services.&lt;br&gt;
Enhanced Maintainability: Smaller, focused services are easier to understand, modify, and maintain compared to monolithic applications.&lt;/p&gt;

&lt;p&gt;Challenges:&lt;br&gt;
Increased Complexity: Managing a distributed system introduces complexity in deployment, testing, monitoring, and debugging.&lt;br&gt;
Data Management: Maintaining consistency and managing data across multiple services can be challenging.&lt;br&gt;
Service Discovery and Communication: Ensuring reliable communication and discovering services dynamically in a distributed environment.&lt;br&gt;
Operational Overhead: Requires robust infrastructure and operational practices to support and monitor microservices effectively.&lt;/p&gt;

&lt;p&gt;Microservices architecture can be categorized into several types or patterns, each emphasizing different aspects of service decomposition, communication patterns, and deployment strategies. Here are some common types of microservices architecture patterns:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Monolithic Application Decomposition&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: In this approach, a monolithic application is decomposed into smaller services, but each service may still be relatively large and cohesive compared to other microservices architectures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Services are typically larger and might handle multiple related functionalities.&lt;/li&gt;
&lt;li&gt;Often uses synchronous communication (e.g., RESTful APIs) between services.&lt;/li&gt;
&lt;li&gt;Deployment and scaling are often handled per service, but still may share some components (e.g., databases).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Layered Architecture&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Services are organized into layers, where each layer represents a set of related functionalities or responsibilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Each layer may be implemented as one or more microservices.&lt;/li&gt;
&lt;li&gt;Communication between layers can be synchronous or asynchronous.&lt;/li&gt;
&lt;li&gt;Promotes separation of concerns and scalability within each layer.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Event-Driven Architecture&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Services communicate through events (messages) asynchronously. Events represent state changes or significant actions within the system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Services are decoupled and communicate through message brokers or event buses.&lt;/li&gt;
&lt;li&gt;Enables loose coupling and scalability by allowing services to react to events without direct dependencies.&lt;/li&gt;
&lt;li&gt;Supports eventual consistency and fault isolation.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;API Gateway Pattern&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: An API Gateway acts as a single entry point for clients to interact with multiple microservices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Provides a unified interface for clients, routing requests to appropriate microservices.&lt;/li&gt;
&lt;li&gt;May handle authentication, rate limiting, and request aggregation.&lt;/li&gt;
&lt;li&gt;Improves client-side performance and simplifies the client's view of the system architecture.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Service Mesh&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: A dedicated infrastructure layer for handling service-to-service communication, including load balancing, service discovery, encryption, and monitoring.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Enhances visibility, reliability, and security of microservices communication.&lt;/li&gt;
&lt;li&gt;Typically implemented using a sidecar proxy (e.g., Envoy) alongside each microservice instance.&lt;/li&gt;
&lt;li&gt;Allows centralized management of microservices communication policies.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Saga Pattern&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Handles long-lived transactions that span multiple microservices, ensuring eventual consistency without distributed transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Uses a series of local transactions (compensating actions) within each microservice.&lt;/li&gt;
&lt;li&gt;Coordination and orchestration are typically managed by a Saga orchestrator.&lt;/li&gt;
&lt;li&gt;Enables rollback and compensation in case of failures, ensuring data consistency across microservices.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;Containerization and Orchestration&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Microservices are deployed as lightweight, isolated containers (e.g., Docker) and orchestrated using platforms like Kubernetes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Simplifies deployment, scaling, and management of microservices.&lt;/li&gt;
&lt;li&gt;Provides infrastructure automation and supports microservices resilience.&lt;/li&gt;
&lt;li&gt;Enables efficient resource utilization and scalability through container orchestration.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;Each type of microservices architecture pattern offers distinct advantages and is suitable for different scenarios based on scalability needs, communication requirements, and operational considerations. The choice of architecture pattern depends on factors such as application complexity, team expertise, scalability requirements, and operational goals.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
