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
curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents'\
-H 'Content-Type: application/json' \
--data-binary @movies.json
const movies = require('./movies.json')
client.index('movies').addDocuments(movies).then((res) => console.log(res))
import json
json_file = open('movies.json')
movies = json.load(json_file)
client.index('movies').add_documents(movies)
$moviesJson = file_get_contents('movies.json');
$movies = json_decode($moviesJson);
$client->index('movies')->addDocuments($movies)
import com.meilisearch.sdk;
import org.json.JSONArray;
import java.nio.file.Files;
import java.nio.file.Path;
Path fileName = Path.of("movies.json");
String moviesJson = Files.readString(fileName);
Client client = new Client(new Config("http://localhost:7700", "masterKey"));
Index index = client.index("movies");
index.addDocuments(moviesJson);
require 'json'
movies_json = File.read('movies.json')
movies = JSON.parse(movies_json)
client.index('movies').add_documents(movies)
import (
"encoding/json"
"io/ioutil"
)
file, _ := ioutil.ReadFile("movies.json")
var movies interface{}
json.Unmarshal([]byte(file), &movies)
client.Index("movies").AddDocuments(&movies)
use meilisearch_sdk::{
indexes::*,
document::*,
client::*,
search::*,
progress::*,
settings::*
};
use serde::{Serialize, Deserialize};
use std::{io::prelude::*, fs::File};
use futures::executor::block_on;
fn main() { block_on(async move {
let client = Client::new("http://localhost:7700", "masterKey");
// reading and parsing the file
let mut file = File::open("movies.json").unwrap();
let mut content = String::new();
file.read_to_string(&mut content).unwrap();
let movies_docs: Vec<Movie> = serde_json::from_str(&content).unwrap();
// adding documents
let movies = client.get_or_create_index("movies").await.unwrap();
movies.add_documents(&movies_docs, None).await.unwrap();
})}
let path = Bundle.main.url(forResource: "movies", withExtension: "json")
let documents: Data = Data(contentsOf: path)
client.index("movies").addDocuments(documents: documents) { (result: Result<Update, Swift.Error>) in
switch result {
case .success(let update):
print(update)
case .failure(let error):
print(error)
}
}
import 'dart:io';
import 'dart:convert';
final jsonFile = await File('movies.json').readAsString();
final movies = json.decode(jsonFile);
await client.index('movies').addDocuments(movies);
Let’s go to http://127.0.0.1:7700
in our browser.
当前内容版权归 MeiliSearch 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 MeiliSearch .