Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Elasticsearch 5.x Cookbook

You're reading from   Elasticsearch 5.x Cookbook Distributed Search and Analytics

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher
ISBN-13 9781786465580
Length 696 pages
Edition 3rd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alberto Paro Alberto Paro
Author Profile Icon Alberto Paro
Alberto Paro
Arrow right icon
View More author details
Toc

Table of Contents (25) Chapters Close

Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface
1. Getting Started FREE CHAPTER 2. Downloading and Setup 3. Managing Mappings 4. Basic Operations 5. Search 6. Text and Numeric Queries 7. Relationships and Geo Queries 8. Aggregations 9. Scripting 10. Managing Clusters and Nodes 11. Backup and Restore 12. User Interfaces 13. Ingest 14. Java Integration 15. Scala Integration 16. Python Integration 17. Plugin Development 18. Big Data Integration

Communicating with Elasticsearch


In Elasticsearch 5.x, there are only two ways to communicate with the server using HTTP protocol or the native one. In this recipe, we will take a look at these main protocols.

Getting ready

The standard installation of Elasticsearch provides access via its web services on port 9200 for HTTP and 9300 for native Elasticsearch protocol. Simply starting an Elasticsearch server, you can communicate on these ports with it.

How it works...

Elasticsearch is designed to be used as a RESTful server, so the main protocol is the HTTP usually on port 9200 and above. This is the only protocol that can be used by programming languages that don't run on a Java Virtual Machine (JVM).

Every protocol has advantages and disadvantages. It's important to choose the correct one depending on the kind of applications you are developing. If you are in doubt, choose the HTTP protocol layer that is the most standard and easy to use.

Choosing the right protocol depends on several factors, mainly architectural and performance related. This schema factorizes the advantages and disadvantages related to them:

Protocol

Advantages

Disadvantages

Type

HTTP

This is more frequently used. It is API safe and has general compatibility for different ES versions. Suggested. JSON.

It is easy to proxy and to balance with HTTP balancers.

This is an HTTP overhead. HTTP clients don't know the cluster topology, so they require more hops to access data.

Text

Native

This is a fast network layer. It is programmatic. It is best for massive index operations.

The API changes and breaks applications. It depends on the same version of ES Server. Only on JVM.

It is more compact due to its binary nature.

It is faster because the clients know the cluster topology.

The native serializer/deserializer are more efficient than the JSON ones.

Binary

You have been reading a chapter from
Elasticsearch 5.x Cookbook - Third Edition
Published in: Feb 2017
Publisher:
ISBN-13: 9781786465580
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime