Convert Figma logo to code with AI

opensearch-project logoOpenSearch

🔎 Open source distributed and RESTful search engine.

9,439
1,730
9,439
1,860

Top Related Projects

Free and Open, Distributed, RESTful Search Engine

Apache Lucene and Solr open-source search software

5,606

AI + Data, online. https://vespa.ai

4,041

CrateDB is a distributed and scalable SQL database for storing and analyzing massive amounts of data in near real-time, even with complex queries. It is PostgreSQL-compatible, and based on Lucene.

4,181

A full-text search engine in rust

19,790

🦔 Fast, lightweight & schema-less search backend. An alternative to Elasticsearch that runs on a few MBs of RAM.

Quick Overview

OpenSearch is an open-source, distributed search and analytics engine derived from Elasticsearch 7.10.2. It offers a powerful full-text search engine, along with analytics and visualization capabilities through OpenSearch Dashboards. OpenSearch is designed to be scalable, flexible, and secure, making it suitable for a wide range of applications and use cases.

Pros

  • Fully open-source and community-driven, ensuring long-term sustainability and innovation
  • Compatible with Elasticsearch APIs, allowing for easy migration from Elasticsearch
  • Offers advanced security features, including fine-grained access control and encryption
  • Highly scalable and performant, capable of handling large-scale data and complex queries

Cons

  • Relatively new project, which may lead to fewer resources and third-party integrations compared to Elasticsearch
  • Learning curve for users new to search engines or coming from other platforms
  • Some advanced features may require additional configuration or plugins

Code Examples

  1. Creating an index and adding a document:
from opensearchpy import OpenSearch

client = OpenSearch(hosts=[{'host': 'localhost', 'port': 9200}])

index_name = 'my-index'
document = {
    'title': 'Monty Python and the Holy Grail',
    'director': 'Terry Gilliam',
    'year': 1975
}

response = client.index(
    index = index_name,
    body = document,
    id = '1',
    refresh = True
)

print(response)
  1. Performing a search query:
from opensearchpy import OpenSearch

client = OpenSearch(hosts=[{'host': 'localhost', 'port': 9200}])

index_name = 'my-index'
query = {
    'query': {
        'match': {
            'title': 'Monty Python'
        }
    }
}

response = client.search(
    body = query,
    index = index_name
)

print(response)
  1. Aggregating data:
from opensearchpy import OpenSearch

client = OpenSearch(hosts=[{'host': 'localhost', 'port': 9200}])

index_name = 'my-index'
query = {
    'aggs': {
        'average_year': {
            'avg': {
                'field': 'year'
            }
        }
    }
}

response = client.search(
    body = query,
    index = index_name
)

print(response)

Getting Started

To get started with OpenSearch, follow these steps:

  1. Install OpenSearch:

    docker pull opensearchproject/opensearch:latest
    docker run -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" opensearchproject/opensearch:latest
    
  2. Install the Python client:

    pip install opensearch-py
    
  3. Connect to OpenSearch:

    from opensearchpy import OpenSearch
    
    client = OpenSearch(hosts=[{'host': 'localhost', 'port': 9200}])
    
  4. Start using OpenSearch for indexing, searching, and analyzing your data using the examples provided above.

Competitor Comparisons

Free and Open, Distributed, RESTful Search Engine

Pros of Elasticsearch

  • Longer history and more mature ecosystem
  • Larger community and more extensive third-party integrations
  • Advanced features like machine learning and anomaly detection

Cons of Elasticsearch

  • Licensing changes have made it less open-source friendly
  • More complex setup and configuration process
  • Higher resource requirements for optimal performance

Code Comparison

Elasticsearch query:

GET /my_index/_search
{
  "query": {
    "match": {
      "title": "search engines"
    }
  }
}

OpenSearch query:

GET /my_index/_search
{
  "query": {
    "match": {
      "title": "search engines"
    }
  }
}

The basic query syntax remains identical between Elasticsearch and OpenSearch, maintaining compatibility for users transitioning between the two systems. However, advanced features and certain APIs may differ in implementation or availability.

Both projects offer powerful full-text search capabilities, but OpenSearch aims to provide a fully open-source alternative to Elasticsearch. While Elasticsearch has a more established presence in the market, OpenSearch is gaining traction among users concerned about licensing issues and those seeking a community-driven solution.

Apache Lucene and Solr open-source search software

Pros of Lucene-Solr

  • Mature project with a long history and established community
  • Highly customizable and extensible architecture
  • Strong support for advanced text analysis and linguistic processing

Cons of Lucene-Solr

  • Steeper learning curve and more complex setup compared to OpenSearch
  • Less focus on distributed search and scalability out of the box
  • Slower development cycle and release frequency

Code Comparison

OpenSearch (Query DSL):

{
  "query": {
    "match": {
      "title": "OpenSearch example"
    }
  }
}

Lucene-Solr (Solr Query Syntax):

title:"Lucene Solr example"

OpenSearch and Lucene-Solr are both powerful search engine technologies, but they have different focuses and strengths. OpenSearch, being a fork of Elasticsearch, emphasizes distributed search and analytics, making it well-suited for large-scale deployments. It also offers a more user-friendly setup process and faster development cycle.

Lucene-Solr, on the other hand, provides more granular control over text analysis and indexing, making it a strong choice for applications requiring advanced linguistic processing. Its modular architecture allows for extensive customization, but this can also lead to a steeper learning curve.

While both projects support various query syntaxes, OpenSearch typically uses JSON-based Query DSL, whereas Lucene-Solr often employs a more compact query syntax. The code examples above illustrate this difference in querying approach.

5,606

AI + Data, online. https://vespa.ai

Pros of Vespa

  • More flexible and customizable for complex search and recommendation use cases
  • Built-in support for machine learning and real-time big data processing
  • Better performance for large-scale, high-throughput applications

Cons of Vespa

  • Steeper learning curve and more complex setup compared to OpenSearch
  • Smaller community and ecosystem of plugins/integrations
  • Less suitable for simple search use cases or smaller datasets

Code Comparison

OpenSearch query example:

GET /my-index/_search
{
  "query": {
    "match": {
      "title": "OpenSearch"
    }
  }
}

Vespa query example:

select * from music where title contains "vespa"

While OpenSearch uses JSON for queries, Vespa employs a SQL-like syntax for simpler queries and a more powerful custom query language for complex operations.

Both projects are open-source search engines, but they cater to different use cases. OpenSearch is more suitable for general-purpose search and analytics, while Vespa excels in advanced, real-time big data applications with machine learning integration.

4,041

CrateDB is a distributed and scalable SQL database for storing and analyzing massive amounts of data in near real-time, even with complex queries. It is PostgreSQL-compatible, and based on Lucene.

Pros of CrateDB

  • Designed specifically for IoT and time-series data, offering better performance for these use cases
  • Built-in support for geospatial data and real-time analytics
  • Easier setup and maintenance, with a more lightweight architecture

Cons of CrateDB

  • Smaller community and ecosystem compared to OpenSearch
  • Limited full-text search capabilities
  • Less extensive documentation and third-party integrations

Code Comparison

OpenSearch (Java):

SearchResponse response = client.search(new SearchRequest()
    .indices("my-index")
    .source(new SearchSourceBuilder()
        .query(QueryBuilders.matchQuery("title", "OpenSearch"))),
    RequestOptions.DEFAULT
);

CrateDB (SQL):

SELECT * FROM my_table
WHERE match(title, 'CrateDB')
LIMIT 10;

Both projects are open-source distributed search and analytics engines, but they have different focuses. OpenSearch is a fork of Elasticsearch, maintaining compatibility with its ecosystem while offering additional features. CrateDB is built on top of Lucene and focuses on IoT and time-series data processing.

OpenSearch provides more comprehensive full-text search capabilities and a larger ecosystem of tools and plugins. CrateDB offers better performance for specific use cases like IoT and time-series data, with built-in support for geospatial data and real-time analytics.

The code comparison shows that OpenSearch uses a Java API for querying, while CrateDB uses SQL-like syntax, making it potentially more familiar to developers with SQL backgrounds.

4,181

A full-text search engine in rust

Pros of Toshi

  • Written in Rust, potentially offering better performance and memory safety
  • Designed with a focus on simplicity and ease of use
  • Smaller codebase, potentially easier to understand and contribute to

Cons of Toshi

  • Less mature and less widely adopted compared to OpenSearch
  • Fewer features and integrations available out-of-the-box
  • Smaller community and ecosystem support

Code Comparison

OpenSearch (Java):

public class IndexRequest extends ReplicationRequest<IndexRequest> implements DocWriteRequest<IndexRequest> {
    private String id;
    private String routing;
    private long version;
    private VersionType versionType = VersionType.INTERNAL;
    private OpType opType = OpType.INDEX;
}

Toshi (Rust):

pub struct IndexDoc {
    pub index: String,
    pub id: Option<String>,
    pub document: serde_json::Value,
}

impl IndexDoc {
    pub fn new(index: String, id: Option<String>, document: serde_json::Value) -> Self {
        IndexDoc { index, id, document }
    }
}

The code snippets show differences in language and structure. OpenSearch uses Java with a more complex class structure, while Toshi uses Rust with a simpler struct definition. OpenSearch includes more fields for versioning and routing, whereas Toshi's example focuses on basic indexing functionality.

19,790

🦔 Fast, lightweight & schema-less search backend. An alternative to Elasticsearch that runs on a few MBs of RAM.

Pros of Sonic

  • Lightweight and fast, designed for quick searches and autocomplete
  • Simple setup and low resource requirements
  • Supports multiple programming languages through its protocol

Cons of Sonic

  • Limited advanced search features compared to OpenSearch
  • Smaller community and ecosystem
  • Less suitable for complex, large-scale search applications

Code Comparison

Sonic query example:

use sonic_channel::*;

let channel = IngestChannel::start("localhost:1491", "SecretPassword").unwrap();
channel.push("collection", "bucket", "object:1", "Hello World!").unwrap();

OpenSearch query example:

from opensearchpy import OpenSearch

client = OpenSearch(hosts=[{'host': 'localhost', 'port': 9200}])
doc = {'title': 'Hello World!', 'content': 'This is a test document.'}
client.index(index='my-index', body=doc, id='1', refresh=True)

Sonic is more focused on simple, fast operations, while OpenSearch offers more complex querying and indexing capabilities. Sonic's API is straightforward, making it easier to integrate for basic search functionality. OpenSearch, being more feature-rich, requires more setup but provides greater flexibility for advanced search scenarios.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Chat Documentation Code Coverage Untriaged Issues Security Vulnerabilities Open Issues Open Pull Requests 2.17.0 Open Issues 3.0.0 Open Issues GHA gradle check GHA validate pull request GHA precommit Jenkins gradle check job

Welcome!

OpenSearch is a community-driven, open source fork of Elasticsearch and Kibana following the license change in early 2021. We're looking to sustain (and evolve!) a search and analytics suite for the multitude of businesses who are dependent on the rights granted by the original, Apache v2.0 License.

Project Resources

Code of Conduct

This project has adopted the Amazon Open Source Code of Conduct. For more information see the Code of Conduct FAQ, or contact opensource-codeofconduct@amazon.com with any additional questions or comments.

Security

If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do not create a public GitHub issue.

License

This project is licensed under the Apache v2.0 License.

Copyright

Copyright OpenSearch Contributors. See NOTICE for details.

Trademark

OpenSearch is a registered trademark of Amazon Web Services.

OpenSearch includes certain Apache-licensed Elasticsearch code from Elasticsearch B.V. and other source code. Elasticsearch B.V. is not the source of that other source code. ELASTICSEARCH is a registered trademark of Elasticsearch B.V.