Friday, 8 April 2016

What is Elasticsearch Analyzers?

Analyzers are pre-processors which are executed on the Text before generating inverted index. 

So why do we need Analyzers in Elasticsearch?

Consider a field which we want have inverted-index

Document 1: "Hello Elasticsearch World "
Document 2: "hello Elasticsearch world"

The Inverted Index looks like this:

Term(Document,Frequency)
Hello(1,1)
World(1,1)
Elasticsearch(1,1),(2,1)
hello(2,1)
world(2,1)

Its evident that "Hello" and "hello" are same words with change in case, As there are two separate indexes for the same word , the query returns partial result when we need a case insensitive search.

To fix the above issue,Now lets have the words converted to lowercase before creating the inverted-index.

Term(Document,Frequency)
hello(1,1),(2,1)
world(1,1),(2,1)
Elasticsearch(1,1),(2,1)

This is what analyzers in Elasticsearch are for. This a simple illustration and analyzers are designed to do more than the example used for illustration.

In simple terms an Analyzer does:
  1. Split the text into individual terms or token, based on whitespace.
  2. Standardize the individual terms so they are searchable.



What is Inverted Index in Elasticsearch

Elasticsearch is a Full Text Search Engine built on top of Lucene. The index structure used in Lucene to enable fast search lookups is called "Inverted Index". 

Inverted index is a simple concept, but yet powerful to enable efficient search. Its a list of unique words(terms) that appear in the documents stored. Each unique words map to list of documents in which they appear along with how many times the word has occurred in the document (Frequency).

Thursday, 17 March 2016

Orchestrating Hadoop Workflows - What your workflow tool should look like.

This post illustrates what are the most important qualities to look for while deciding a Big data workflow tool.


  1. Schedule the ETL process to ingest incremental data from various streams.

    Ability to schedule is the most elementary requirement of any orchestration tool, and the tool
    must be abel to ingest and process data simultaneously form various sources to various endpoints. It should support most common sources and endpoints out of the box.

  2. Notifications on failure of ETL process.

    Notifications and Alerts are a must, a failure can setback you to backfill and can drastically increase the infrastructure costs (especially if u pay by the hour for the cluster). So a good reliable notification mechanism is essential and a must have.

  3. Optimization on resources usage for daily ingestion.

    Not directly supported by the workflow tool, but the tool should persist the execution time and trends for a task, which can be used to optimize your tasks. This data becomes important when you have run the workflow sufficiently and can understand the time trends.

  4. Retry on failures, make ur tasks as Idempotent incremental loads

    The ownership of making the workflow idempotent is on the developer and not the tool. The tool should support retires.

  5. Zero/Minimal Manual intervention

  6. Self recovering/ rescheduling system

  7. Pause the workflow

    The tool should support you , when needed to pause the execution after the current running task. This enables you to fix any issue with the next task in your workflow without having to fail the workflow.

  8. Automatic Data audits, for incremental loaded data.

    Should support audits on tasks and help make decision in the workflow.



Friday, 4 March 2016

Submit Hive queries to different Queues

Hive Execution Engine is MapReduce 
set mapreduce.job.queuename=<queuename>; 

Hive Execution Engine is Tez
set tez.queue.name=<queuename>; 

Hive Default Field Delimiter

\U0001  ( CTRL+SHIFT+A in windows) 

Hive RuntimeException

"Failed with exception java.io.IOException:java.lang.RuntimeException: serious problem"

If the hive cluster is a Kerberos secured cluster, disable Hive optimizations.

set hive.fetch.task.conversion=none;

Friday, 26 February 2016

Configuring STMP with gmail

  
Exception: File "/usr/lib/python2.7/smtplib.py", line 366, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")

smtplib.SMTPServerDisconnected: Connection unexpectedly closed


Check the port you have configured for gmail.
If ur using SSL(465) change to TLS (587) , vice versa.