search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso

Getting Started with App Search

This guide will walk you through the first steps of setting up your Swiftype account, creating your first App Search engine, ingesting a small set of data and testing out a few queries against your freshly created search index.

For in-depth documentation and advanced material, head to the Guides section.

Step 1 - Signing up for a Swiftype account

Your Swiftype account is where you manage your engines, users, limits, and billing. If you haven't done so already, sign up for your free App Search trial account. Once your email address has been confirmed, select the App Search product from the Swiftype product selector.

Signing Up - Access the App Search trial
Selecting the App Search product

Step 2 - Creating an engine

An engine is a data repository that includes intelligently indexed records, associated search analytics data, and well as dataset-level configurations such as weights and result positioning.

To create an engine, locate and click the Create an Engine button from your account home.

Creating an engine - Enter your new engine's name
Creating an engine
Take note that your engine name will be used as an identifier when making API calls or issuing search queries.

Step 3 - Locating your API credentials

After creating your first engine, you can locate the various keys required to issue document indexing and searching API requests by visiting the API Keys area in the App Search dashboard.

API Keys - Locate the Account Host Key and API Key
Credentials view
For a more complete authentication overview, refer to the API Keys guide guide.

Step 4 - Indexing documents

With your API credentials handy, you may now start adding documents to your newly created engine using the Documents API. Swiftype App Search does not require you to define a schema prior to indexing your initial documents -- all fields are indexed as text by default. You can unlock other search functionality over your documents by changing the field type in the *Schema area in the App Search Dashboard.

Using the API Client of your choice, or simply using cURL to submit API requests, you can start indexing a small number of documents as an array of JSON objects, making sure to prefix the host with your Account Host Key, and including your API key as the HTTP authorization request header:

Example - Indexing a document in the rent-a-car engine
curl -X POST 'https://host-7s23ap.api.swiftype.com/api/as/v1/engines/rent-a-car/documents' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer api-3958sdlfjadsf' \
-d '[
    {
      "id": "441376183",
      "make": "Toyota",
      "model": "4RUNNER",
      "year": "2017",
      "color": "blue",
      "drivetrain": "AWD",
      "category": "Full-Size SUV",
      "seats": 7,
      "status": "available",
      "daily_rate": 79,
      "ac": true,
      "mileage_policy": "unlimited",
      "current_location": "37.6213, -122.3790"
    }
  ]'

Example - Indexing a document in the rent-a-car engine
require 'swiftype-app-search'

client = SwiftypeAppSearch::Client.new(:account_host_key => 'host-7s23ap', :api_key => 'api-3958sdlfjadsf')
engine_name = 'rent-a-car'
documents = [
  {
    'id': '441376183',
    'make': 'Toyota',
    'model': '4RUNNER',
    'year': '2017',
    'color': 'blue',
    'drivetrain': 'AWD',
    'category': 'Full-Size SUV',
    'seats': 7,
    'status': 'available',
    'daily_rate': 79,
    'ac': true,
    'mileage_policy': 'unlimited',
    'current_location': '37.6213, -122.3790'
  }
]

begin
  index_document_results = client.index_documents(engine_name, documents)
  # handle index document results
rescue SwiftypeAppSearch::ClientException => e
  # handle error
end

Example - Indexing a document in the rent-a-car engine
from swiftype_app_search import Client
from swiftype_app_search.exceptions import SwiftypeAppSearchError

client = Client('host-7s23ap', 'api-3958sdlfjadsf')
engine_name = 'rent-a-car'
documents = [
  {
    'id': '441376183',
    'make': 'Toyota',
    'model': '4RUNNER',
    'year': '2017',
    'color': 'blue',
    'drivetrain': 'AWD',
    'category': 'Full-Size SUV',
    'seats': 7,
    'status': 'available',
    'daily_rate': 79,
    'ac': True,
    'mileage_policy': 'unlimited',
    'current_location': '37.6213, -122.3790'
  }
]

try:
    index_document_results = client.index_documents(engine_name, documents)
except SwiftypeAppSearchError:
    # handle exception
    pass

Example - Indexing a document in the rent-a-car engine
const SwiftypeAppSearchClient = require('swiftype-app-search-node')

const client = new SwiftypeAppSearchClient('host-7s23ap', 'api-3958sdlfjadsf')
const engineName = 'rent-a-car'
documents = [
  {
    'id': '441376183',
    'make': 'Toyota',
    'model': '4RUNNER',
    'year': '2017',
    'color': 'blue',
    'drivetrain': 'AWD',
    'category': 'Full-Size SUV',
    'seats': 7,
    'status': 'available',
    'daily_rate': 79,
    'ac': true,
    'mileage_policy': 'unlimited',
    'current_location': '37.6213, -122.3790'
  }
]

client.indexDocuments(engineName, documents)
  .then((indexDocumentResults) => {
    // handle index document results
  })
  .catch((error) => {
    // handle error
  })

Example - Indexing a document in the rent-a-car engine
import com.swiftype.appsearch.Client;
import com.swiftype.appsearch.ClientException;
import java.util.*;

Client client = new Client("host-7s23ap", "api-3958sdlfjadsf");
String engineName = "rent-a-car";

Map<String, Object> doc = new HashMap<>();
doc.put("id", "441376183");
doc.put("make", "Toyota");
doc.put("model", "4RUNNER");
doc.put("year", "2017");
doc.put("color", "blue");
doc.put("drivetrain", "AWD");
doc.put("category", "Full-Size SUV");
doc.put("seats", 7);
doc.put("status", "available");
doc.put("daily_rate", 79);
doc.put("ac", true);
doc.put("mileage_policy", "unlimited");
doc.put("current_location", "37.6213, -122.3790");

List<Map<String, Object>> documents = Arrays.asList(doc);

try {
  List<Map<String, Object>> indexDocumentResults = client.indexDocuments(engineName, documents);
} catch (ClientException e) {
  // handle error
}

You may confirm that the documents were properly indexed by visiting the Documents area of the App Search dashboard. May you encounter any issue while indexing documents, you may also refer to the API Logs area of the dashboard for more information on request failures.

The Indexing Documents guide covers document ingestion in greater detail, including additional document operations, and schema updates.

Step 5 - Searching documents

There are multiple ways to query over the content now contained within your engine. The simplest, fastest way to experiment with querying is using the Query Tester found in the App Search Dashboard:

Testing a query - Enter any term that matches one or more documents
Query Tester

The Searching guide is a great place to start when issuing your first search queries via the Search API, as it covers basic search features and query customizations.

Next steps

While this getting started guide a very high-level view of the App Search functionality, you have already covered the most important aspects of interacting with the search platform, whether it be through the dashboard, or the API itself. From here, you can dive deeper into the key concepts of indexing and searching in the Guides section


Found any inconsistency with this article? Let us know!