Web interface

After adding documents to your MeiliSearch, it is possible to try out the search engine with the integrated web interface.

The web interface is served on the address and port specified in the command line argument --http-addr. If not specified, the default address and port is used.

WARNING

Since the production environment requires an API-key for searching, the web interface is only available in development mode.

Example

By default the web server can be reached on http://127.0.0.1:7700.

Let’s add some movies.

<>

cURL

JS

Python

PHP

Java

Ruby

Go

Rust

Swift

Dart

  1. curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents'\
  2. -H 'Content-Type: application/json' \
  3. --data-binary @movies.json
  1. const movies = require('./movies.json')
  2. client.index('movies').addDocuments(movies).then((res) => console.log(res))
  1. import json
  2. json_file = open('movies.json')
  3. movies = json.load(json_file)
  4. client.index('movies').add_documents(movies)
  1. $moviesJson = file_get_contents('movies.json');
  2. $movies = json_decode($moviesJson);
  3. $client->index('movies')->addDocuments($movies)
  1. import com.meilisearch.sdk;
  2. import org.json.JSONArray;
  3. import java.nio.file.Files;
  4. import java.nio.file.Path;
  5. Path fileName = Path.of("movies.json");
  6. String moviesJson = Files.readString(fileName);
  7. Client client = new Client(new Config("http://localhost:7700", "masterKey"));
  8. Index index = client.index("movies");
  9. index.addDocuments(moviesJson);
  1. require 'json'
  2. movies_json = File.read('movies.json')
  3. movies = JSON.parse(movies_json)
  4. client.index('movies').add_documents(movies)
  1. import (
  2. "encoding/json"
  3. "io/ioutil"
  4. )
  5. file, _ := ioutil.ReadFile("movies.json")
  6. var movies interface{}
  7. json.Unmarshal([]byte(file), &movies)
  8. client.Index("movies").AddDocuments(&movies)
  1. use meilisearch_sdk::{
  2. indexes::*,
  3. document::*,
  4. client::*,
  5. search::*,
  6. progress::*,
  7. settings::*
  8. };
  9. use serde::{Serialize, Deserialize};
  10. use std::{io::prelude::*, fs::File};
  11. use futures::executor::block_on;
  12. fn main() { block_on(async move {
  13. let client = Client::new("http://localhost:7700", "masterKey");
  14. // reading and parsing the file
  15. let mut file = File::open("movies.json").unwrap();
  16. let mut content = String::new();
  17. file.read_to_string(&mut content).unwrap();
  18. let movies_docs: Vec<Movie> = serde_json::from_str(&content).unwrap();
  19. // adding documents
  20. let movies = client.get_or_create_index("movies").await.unwrap();
  21. movies.add_documents(&movies_docs, None).await.unwrap();
  22. })}
  1. let path = Bundle.main.url(forResource: "movies", withExtension: "json")
  2. let documents: Data = Data(contentsOf: path)
  3. client.index("movies").addDocuments(documents: documents) { (result: Result<Update, Swift.Error>) in
  4. switch result {
  5. case .success(let update):
  6. print(update)
  7. case .failure(let error):
  8. print(error)
  9. }
  10. }
  1. import 'dart:io';
  2. import 'dart:convert';
  3. final jsonFile = await File('movies.json').readAsString();
  4. final movies = json.decode(jsonFile);
  5. await client.index('movies').addDocuments(movies);

Let’s go to http://127.0.0.1:7700 in our browser.