GithubHelp home page GithubHelp logo

v1pr / fts-manticore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atkinsj/fts-elasticsearch

0.0 0.0 0.0 264 KB

Manticore FTS implementation for the Dovecot mail server

License: Other

Shell 46.85% C 47.76% Makefile 0.48% M4 4.91%

fts-manticore's Introduction

fts-elasticsearch

fts-elasticsearch is a Dovecot full-text search indexing plugin that uses ElasticSearch as a backend.

Dovecot communicates to ES using HTTP/JSON queries. It supports automatic indexing and searching of e-mail.

Requirements

  • Dovecot 2.2+
  • JSON-C
  • ElasticSearch 6.x for your server
  • Autoconf 2.53+

NOTE: You must add -Des.xcontent.strict_duplicate_detection=false to your Elasticsearch startup parameters. ES 7.0 will NOT be compatible with this plugin for now since this option will be deprecated.

Compiling

This plugin needs to compile against the Dovecot source for the version you intend to run it on. A dovecot-devel package is unfortunately insufficient as it does not include the required fts API header files.

You can provide the path to your source tree by passing --with-dovecot= to ./configure.

An example build may look like:

./autogen.sh
./configure --with-dovecot=/path/to/dovecot/src/root
make
make install

Configuration

In dovecot/conf.d/10-mail.conf:

mail_plugins = fts fts_elasticsearch

In dovecot/conf.d/90-plugins.conf:

plugin {
  fts = elasticsearch
  fts_elasticsearch = debug url=http://localhost:9200/
  fts_autoindex = yes
}

There are only two supported configuration parameters at the moment:

  • url=<elasticsearch url> Required base URL
  • debug Enables HTTP debugging

ElasticSearch Indicies

fts-elasticsearch creates an index per mail box with a hardcoded type of 'mail'. It creates one field for each field in the e-mail header and for the body.

An example of pushed data for a basic e-mail with no attachments:

{
	"uid": 3,
	"box": "f40efa2f8f44ad54424000006e8130ae",
	"Return-Path": "<[email protected]>",
	"X-Original-To": "josh",
	"Delivered-To": "[email protected]",
	"Received": "by localhost.localdomain (Postfix, from userid 1000) id 07DA3140314; Thu,  8 Jan 2015 00:20:05 +1100 (AEDT)",
	"Date": "Thu, 08 Jan 2015 00:20:05 +1100",
	"To": "[email protected]",
	"Subject": "Test #3",
	"User-Agent": "Heirloom mailx 12.5 7\/5\/10",
	"MIME-Version": "1.0",
	"Content-Type": "text\/plain; charset=us-ascii",
	"Content-Transfer-Encoding": "7bit",
	"Message-Id": "<[email protected]>",
	"From": "josh <[email protected]>",
	"body": "This is the body of test #3.\n"
}

An example search:

{
  "query": {
    "query_string": {
      "query": "*Dovecot*",
      "fields": [
        "subject"
      ]
    }
  },
  "fields": [
    "uid",
    "box"
  ]
}

TODO

There are a number of things left to be implemented:

  • Rescan
  • Optimisation (if any)
  • Multiple mailbox lookup (for clients that call lookup_multi; need to find one)

Background

Dovecot currently supports two primary full text search indexing plugins fts-solr and fts-squat. I wanted to use an FTS service that I already had set-up and that wasn't quite as heavy as Solr, primarily to consolidate infrastructure and to focus resources on optimising our ES instances.

Thanks

This plugin borrows heavily from dovecot itself particularly for the automatic detection of dovecont-config (see m4/dovecot.m4). The fts-solr and fts-squat plugins were also used as reference material for understanding the Dovecot FTS API.

fts-manticore's People

Contributors

atkinsj avatar infernix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.