Vector Search for Practitioners with Elastic

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Optimize your search capabilities in Elastic by operationalizing and fine-tuning vector search and enhance your search relevance while improving overall search performance Key Features Install, configure, and optimize the ChatGPT-Elasticsearch plugin with a focus on vector data Learn how to load transformer models, generate vectors, and implement vector search with Elastic Develop a practical understanding of vector search, including a review of current vector databases Purchase of the print or Kindle book includes a free PDF eBook Book Description While natural language processing (NLP) is largely used in search use cases, this book aims to inspire you to start using vectors to overcome equally important domain challenges like observability and cybersecurity. The chapters focus mainly on integrating vector search with Elastic to enhance not only their search but also observability and cybersecurity capabilities. The book begins by teaching you about NLP and the functionality of Elastic in NLP processes. Next, you’ll delve into resource requirements and find out how vectors are stored in the dense-vector type along with specific page cache requirements for fast response times. As you advance, you’ll discover various tuning techniques and strategies to improve machine learning model deployment, including node scaling, configuration tuning, and load testing with Rally and Python. You’ll also cover techniques for vector search with images, fine-tuning models for improved performance, and the use of clip models for image similarity search in Elasticsearch. Finally, you’ll explore retrieval-augmented generation (RAG) and learn to integrate ChatGPT with Elasticsearch to leverage vectorized data, ELSER's capabilities, and RRF's refined search mechanism. By the end of this NLP book, you’ll have all the necessary skills needed to implement and optimize vector search in your projects with Elastic. What you will learn Optimize performance by harnessing the capabilities of vector search Explore image vector search and its applications Detect and mask personally identifiable information Implement log prediction for next-generation observability Use vector-based bot detection for cybersecurity Visualize the vector space and explore Search.Next with Elastic Implement a RAG-enhanced application using Streamlit Who this book is for If you're a data professional with experience in Elastic observability, search, or cybersecurity and are looking to expand your knowledge of vector search, this book is for you. This book provides practical knowledge useful for search application owners, product managers, observability platform owners, and security operations center professionals. Experience in Python, using machine learning models, and data management will help you get the most out of this book.

Author(s): Bahaaldine Azarmi, Jeff Vestal
Edition: 1
Publisher: Packt Publishing Pvt Ltd
Year: 2023

Language: English
Pages: 308

Vector Search for Practitioners with Elastic
Foreword
Contributors
About the authors
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Share Your Thoughts
Download a free PDF copy of this book
Part 1:Fundamentals of Vector Search
1
Introduction to Vectors and Embeddings
Exploring the roles of supervised and unsupervised learning in vector search
What’s an embedding/vector?
What challenges are vectors solving?
The developer experience
Hugging Face
The market landscape and how it has accelerated the developer experience
Use cases and domains of application
AI-based search
Named Entity Recognition (NER)
Sentiment analysis
Text classification
Question-answering (QA)
Text summarization
How is Elastic playing a role in this space?
A primer on observability and cybersecurity
Summary
2
Getting Started with Vector Search in Elastic
Search experience in Elastic before vectors
Data type and its impact on relevancy
The relevancy model
Evolution of search experience
The limits of keyword-based search
Vector representation
The new vector data type and the vector search query API
Sparse and dense vectors
An Elastic Cloud quick start
Dense vector mapping
Brute-force kNN search
kNN search
Summary
Part 2: Advanced Applications and Performance Optimization
3
Model Management and Vector Considerations in Elastic
Technical requirements
Hugging Face
Model Hub
Datasets
Spaces
Eland
Loading a Sentence Transformer from Hugging Face into Elasticsearch
Configuring Elasticsearch authentication
Loading a model from the Hugging Face Hub
Downloading the model
Loading the model into Elasticsearch
Starting the model
Deploying the model
Generating a vector for a query
Generating vectors in Elasticsearch
Planning for cluster capacity and resources
CPU and memory requirements
Disk requirements
Analyze Index Disk Usage API
ML node capacity
Storage efficiency strategies
Reducing dimensionality
Quantization
Excluding dense_vector from _source
Summary
4
Performance Tuning – Working with Data
Deploying an NLP model
Loading a model into Elasticsearch
Model deployment configurations
Load testing
Rally
RAM estimation
Troubleshooting slowdown
Summary
Part 3: Specialized Use Cases
5
Image Search
Overview of image search
The evolution of image search
The mechanism behind image search
The role of vector similarity search
Image search in practice
Vector search with images
Image vectorization
Indexing image vectors in Elasticsearch
k-Nearest Neighbor (kNN) search
Challenges and limitations with image search
Multi-modal models for vector search
Introduction and rationale
Understanding the concept of vector space in multi-modal models
Introduction to the OpenAI clip-ViT-B-32-multilingual-v1 model
Implementing vector search for diverse media types
Summary
6
Redacting Personal Identifiable Information Using Elasticsearch
Overview of PII and redaction
Types of data that may contain PII
Risks of storing PII in logs
How PII is leaked or lost
Redacting PII with NER models and regex patterns
NER models
Regex patterns
Combining NER models and regex (or grok) patterns for PII redaction
PII redaction pipeline in Elasticsearch
Generating synthetic PII
Installing the default pipeline
Expected results
Expanding and customizing options for the PII redaction pipeline in Elasticsearch
Customizing the default PII example
Cloning the pipeline to create different versions for different data streams
Fine-tuning NER models for particular datasets
Logic for contextual awareness
Summary
7
Next Generation of Observability Powered by Vectors
Introduction to observability and its importance in modern software systems
Observability—main pillars
Log analytics and its role in observability
A new approach—applying vectors and embeddings to log analytics
Approach 1—training or fine-tuning an existing model for logs
Approach 2—generating human-understandable descriptions and vectorizing these descriptions
Log vectorization
Synthetic log
Expanding logs at write with OpenAI
Semantic search on our logs
Building a query using log vectorization
Loading a model
Ingest pipeline
Semantic search
Summary
8
The Power of Vectors and Embedding in Bolstering Cybersecurity
Technical requirements
Understanding the importance of email phishing detection
What is phishing?
Different types of phishing attacks
Statistics on the frequency of phishing attacks
Challenges in detecting phishing emails
Role of automated detection
Augmenting existing techniques with natural language processing
Introducing ELSER
The role of ELSER in GenAI
Introduction to the Enron email dataset (ham or spam)
Seeing ELSER in action
Hardware consideration
Downloading the ELSER model in Elastic
Setting up the index and ingestion pipeline
Semantic search with ELSER
Limitations of ELSER
Summary
Part 4: Innovative Integrations and Future Directions
9
Retrieval Augmented Generation with Elastic
Preparing for RAG-enhanced search with ELSER and RRF
Semantic search with ELSER
A recap of essential considerations for RAG
Integrating ELSER with RRF
Language models and RAG
In-depth case study—implementing a RAG-enhanced CookBot
Dataset overview – an introduction to the Allrecipes.com dataset
Preparing data for RAG-enhanced search
Building the retriever—RRF with ELSER
Leveraging the retriever and implementing the generator
Summary
10
Building an Elastic Plugin for ChatGPT
Contextual foundations
The paradigm of dynamic context
Dynamic Context Layer plugin vision—architecture and flow
Building the DCL
Fetching the latest information from Elastic documentation
Elevating data with Embedchain
Integrating with ChatGPT—creating a real-time conversationalist
Deployment
Summary
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book