Search API Documentation Getting Started

This managed service exposes the search features of Apache Lucene™ over a REST/JSON API. Here is how it works:

1 Calling :
curl -XPOST  "https://search1.opensearchserver.net/indexes/my_uuid/my_index"
2 Returns :
{
  "num_docs": 0,
  "num_deleted_docs": 0,
  "settings": {}
}
3 The index is created.
1 Define some fields in a json file: my_fields.json
{
  "$id$": {
    "template": "StringField"
  },
  "name": {
    "tokenized": true,
    "analyzer": "en.EnglishAnalyzer",
    "stored": true,
    "index_options": "DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS"
  },
  "description": {
    "tokenized": true,
    "analyzer": "en.EnglishAnalyzer",
    "stored": true,
    "index_options": "DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS"
  },
  "category": {
    "template": "SortedSetMultiDocValuesFacetField"
  }
}
2 Post your json file
curl -XPOST -H 'Content-Type: application/json' -d @my_fields.json \
    "https://search1.opensearchserver.net/indexes/my_uuid/my_index/fields"
3 The fields are created.
1 Define some documents in a json file: my_docs.json
[
  {
    "$id$": "1",
    "name": "First article",
    "description": "This is the description of the first article.",
    "category": [
      "news",
      "economy"
    ]
  },
  {
    "$id$": "2",
    "name": "Second article",
    "description": "This is the description of the second article.",
    "category": [
      "news",
      "science"
    ]
  }
]
2 Post your json file
curl -XPOST -H 'Content-Type: application/json' -d @my_docs.json \
    "https://search1.opensearchserver.net/indexes/my_uuid/my_index/docs"
3 The documents are indexed.
1 Define your search query in a json file: my_search.json
{
  "start": 0,
  "rows": 10,
  "query_string": "Article",
  "query": {
    "query": "BooleanQuery",
    "clauses": [
      {
        "occur": "must",
        "query": {
          "query": "MultiFieldQueryParser",
          "fields": [
            "name",
            "description"
          ],
          "boosts": {
            "name": 10,
            "description": 1
          }
        }
      },
      {
        "occur": "filter",
        "query": {
          "query": "BooleanQuery",
          "clauses": [
            {
              "occur": "must",
              "query": {
                "query": "FacetPathQuery",
                "dimension": "category",
                "path": [
                  "news"
                ]
              }
            }
          ]
        }
      }
    ]
  },
  "facets": {
    "category": {
      "top": 10
    }
  },
  "returned_fields": [
    "name"
  ],
  "highlighters": {
    "my_description": {
      "field": "description"
    }
  }
}
3 Get your search result:
{
  "timer": {
    "start_time": "2016-03-27T18:26:17.919+0000",
    "total_time": 3,
    "unknown_time": 0,
    "durations": {
      "search_query": 1,
      "facet_count": 0,
      "highlighting": 1,
      "returned_fields": 1,
      "facet_fields": 0
    }
  },
  "total_hits": 2,
  "max_score": 0.3993194,
  "documents": [
    {
      "score": 0.3993194,
      "percent_score": 1.0,
      "fields": {
        "name": "First article"
      },
      "highlights": {
        "my_description": "This is the description of the first article."
      }
    },
    {
      "score": 0.3993194,
      "percent_score": 1.0,
      "fields": {
        "name": "Second article"
      },
      "highlights": {
        "my_description": "This is the description of the second article."
      }
    }
  ],
  "facets": {
    "category": {
      "news": 2,
      "economy": 1,
      "science": 1
    }
  }
}
2 Post your search request:
curl -XPOST -H 'Content-Type: application/json' -d @my_search.json \
    "https://search1.opensearchserver.net/indexes/my_uuid/my_index/search"

Pricing


  • A comprehensive set of Search API
  • Full text search, boolean search, range searches, faceting, highlighting
  • Unlimited support
  • Fully scalable with a simple pricing model
  • Starting from $10 USD per month for 200,000 records (1)
  • Free Trial (2) with 1,000 records
Units
Number of records
Number of indices
Simultaneous read access
Simultaneous write access
Price per month (1) $

Start your free trial (2)