Book Image

ElasticSearch Cookbook

By : Alberto Paro
Book Image

ElasticSearch Cookbook

By: Alberto Paro

Overview of this book

ElasticSearch is one of the most promising NoSQL technologies available and is built to provide a scalable search solution with built-in support for near real-time search and multi-tenancy. This practical guide is a complete reference for using ElasticSearch and covers 360 degrees of the ElasticSearch ecosystem. We will get started by showing you how to choose the correct transport layer, communicate with the server, and create custom internal actions for boosting tailored needs. Starting with the basics of the ElasticSearch architecture and how to efficiently index, search, and execute analytics on it, you will learn how to extend ElasticSearch by scripting and monitoring its behaviour. Step-by-step, this book will help you to improve your ability to manage data in indexing with more tailored mappings, along with searching and executing analytics with facets. The topics explored in the book also cover how to integrate ElasticSearch with Python and Java applications. This comprehensive guide will allow you to master storing, searching, and analyzing data with ElasticSearch.
Table of Contents (19 chapters)
ElasticSearch Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing a river


In ElasticSearch, the following are the two main action-related river setups:

  • Creating a river

  • Deleting a river

Getting ready

You need a working ElasticSearch cluster.

How to do it...

For managing a river, we need to perform the following steps:

  1. A river is uniquely defined by a name and a type. The type of the river is the type name defined in the loaded river plugins.

  2. After the name and the type parameters, usually a river requires an extra configuration that can be passed in the _meta property.

  3. To create a river, the HTTP method is PUT (POST also works):

    curl -XPUT 'http://127.0.0.1:9200/_river/my_river/_meta' -d '{
        "type" : "dummy"
    }'

    The dummy type is a "fake" river always installed in ElasticSearch.

  4. The result will be as follows:

    {"ok":true,"_index":"_river","_type":"my_river","_id":"_meta","_version":1}
  5. If you look at ElasticSearch logs, you'll see some new lines, which are as follows:

    [2013-08-03 20:48:39,206][INFO ][cluster.metadata         ] [Elsie-Dee] [_river] creating index...