Docs Menu
Docs Home
/
MongoDB Atlas
/ / / /

자동 완성 기능

이 페이지의 내용

  • 정의
  • 샘플 사용 사례
  • 구문
  • 옵션
  • 채점 동작
  • 예시
  • 인덱스 정의
  • 기본 예시
  • 퍼지 예시
  • 토큰 주문 예시
  • 예시로 시작
  • 간단한 any 예시
  • 간단한 sequential 예시
  • 강조 표시 예시
  • 여러 필드에서 검색
  • 패싯 쿼리를 통한 버킷 결과
autocomplete

autocomplete 연산자는 불완전한 입력 문자열에서 문자 시퀀스를 포함하는 단어나 구문을 검색합니다. autocomplete 연산자를 사용하여 쿼리하려는 필드는 컬렉션의 인덱스 정의에 있는 자동 완성 데이터 유형으로 인덱싱되어야 합니다. 자동 완성을 위한 인덱스를 구성하는 방법을 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

참고

Atlas Search는 단일 문자열에 세 개 이상의 단어가 포함된 쿼리에 대해 부정확한 결과를 반환할 수 있습니다.

입력 시 실시간 검색 애플리케이션에서 autocomplete 연산자를 사용하면 애플리케이션의 검색 필드에 문자가 입력될 때 단어를 더욱 정확하게 예측할 수 있습니다. autocomplete는 자동 완성을 위해 인덱스 정의에 지정된 토큰화 전략을 기반으로 한 예측 단어가 포함된 결과를 반환합니다.

Atlas Search autocomplete 연산자를 사용하여 추천 또는 드롭다운을 작성하려는 경우 추천 검색어 모음을 쿼리하거나 과거 검색어를 사용하여 드롭다운을 채우는 것이 좋습니다. 제안된 검색어의 별도 컬렉션을 만들면 Atlas Search 인덱스에서 동의어 매핑을 정의하여 컬렉션에서 정확한 단어나 대체 단어를 검색할 수 있습니다. 검색어를 추적하고 검색어에 대한 지표를 확인하여 컬렉션을 구축할 수 있습니다.

autocomplete 의 구문은 다음과 같습니다:

1{
2 $search: {
3 "index": "<index name>", // optional, defaults to "default"
4 "autocomplete": {
5 "query": "<search-string>",
6 "path": "<field-to-search>",
7 "tokenOrder": "any|sequential",
8 "fuzzy": <options>,
9 "score": <options>
10 }
11 }
12}
필드
유형
설명
필요성
기본값
query
문자열 또는 문자열 배열
검색할 문자열을 하나 이상 입력합니다. 한 문자열에 여러 개의 용어가 있는 경우 Atlas Search는 문자열의 각 용어에 대해 개별적으로 일치하는 항목을 찾습니다.
path
문자열

검색할 인덱싱된 필드입니다. 이 필드는 autocomplete 데이터 유형으로 인덱싱되어야 합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

autocomplete 연산자는 path 매개 변수에서 multi 또는 wildcard (*) 옵션을 지원 하지 않습니다. 또한 path 값으로 필드 배열을 지원 하지 않습니다. 자세한 내용은 쿼리 경로 구성을 참조하세요.

여러 필드에 걸친 autocomplete 연산자 쿼리의 예시는 여러 필드에서 검색 또는 Atlas Search에서 자동 완성을 사용하는 방법의 고급 예제를 참조하세요.

fuzzy
객체
퍼지 검색을 활성화하도록 설정합니다. 검색어 또는 용어와 유사한 문자열을 찾습니다.
no
fuzzy
.maxEdits
integer
지정된 검색 용어와 일치하는 데 필요한 최대 단일 문자 편집 수입니다. 값은 1 또는 2일 수 있습니다.
no
2
fuzzy
.prefixLength
integer
정확히 일치해야 하는 결과의 각 용어 시작 부분에 있는 문자 수입니다.
no
0
fuzzy
.maxExpansions
integer
생성하고 검색할 수 있는 최대 변형 수입니다. 이 한도는 토큰 단위로 적용됩니다.
no
50
score
객체

일치하는 검색어 결과에 할당할 점수입니다. 다음 옵션 중 하나를 사용하여 기본 점수를 수정합니다:

boost
결과 점수에 주어진 숫자를 곱합니다.
constant
결과 점수를 주어진 숫자로 바꿉니다.
function
결과 점수를 주어진 표현식으로 바꿉니다.

autocomplete 쿼리 실행 속도가 빨라지는 대신 점수 정확도가 떨어집니다. 자세히 알아보려면 채점 동작을 참조하세요.

쿼리에서 score 사용에 대한 자세한 내용은 결과에서 문서 채점하기를 참조하십시오.

no
tokenOrder
문자열

토큰을 검색할 순서입니다. 값은 다음 중 하나일 수 있습니다:

any
쿼리의 토큰이 문서에서 어떤 순서로든 나타날 수 있음을 나타냅니다. 결과에는 토큰이 순차적으로 또는 비순차적으로 표시되는 문서가 포함됩니다. 그러나 토큰이 순차적으로 나타나는 결과는 다른 비순차적 값보다 높은 점수를 얻습니다.
sequential
쿼리의 토큰이 서로 인접해 있거나 문서의 쿼리에 지정된 순서대로 나타나야 함을 나타냅니다. 결과에는 토큰이 순차적으로 나타나는 문서만 포함됩니다.
no
any

autocomplete연산자로 쿼리된 결과 중 정확히 일치하는 결과는 정확히 일치하지 않는 결과보다 낮은 점수를 받습니다. 자동 완성 인덱싱된 토큰의 하위 문자열만 지정된 경우, Atlas Search는 쿼리 문자열이 인덱싱된 텍스트와 정확히 일치하는지 여부를 판단할 수 없습니다. 정확한 일치의 점수를 높이려면 다음과 같은 해결 방법을 시도해 볼 수 있습니다.

참고

하지만, 이 우회 방법이 모든 경우에 정확히 일치하는 결과에 더 높은 점수를 보장하는 것은 아닙니다.

  1. 필드를 자동 완성문자열 유형으로 인덱싱합니다.

    Atlas Search의 autocompleteautocomplete 필드가 string으로도 인덱싱되어 있을 때 정확한 일치 항목을 강화하여, 일치 항목의 점수를 증가시킵니다.

  2. 복합 연산자를 사용하여 쿼리합니다.

이 해결 방법의 데모는 여러 필드에서 검색하기 섹션을 참조하세요.

다음 예시에서는 sample_mflix 데이터베이스의 movies 컬렉션을 사용합니다. 클러스터에 샘플 데이터 세트를 로드한 경우 자동 완성을 위한 정적 인덱스를 생성하고 클러스터에서 예시 쿼리를 실행할 수 있습니다.

샘플 데이터 집합을 이미 로드한 경우, Atlas Search 시작하기 자습서에 따라 인덱스 정의를 만들고 Atlas Search 쿼리를 실행하세요.

다음 탭에는 edgeGram, rightEdgeGram, nGram 토큰화 전략에 대한 샘플 인덱스 정의가 포함되어 있습니다. 자동 완성 유형 외에도 샘플 인덱스 정의에는 title 필드에 문자열stringFacet 유형이 포함되어 있습니다.

1{
2 "mappings": {
3 "dynamic": false,
4 "fields": {
5 "title": [
6 {
7 "type": "stringFacet"
8 },
9 {
10 "type": "string"
11 },
12 {
13 "foldDiacritics": false,
14 "maxGrams": 7,
15 "minGrams": 3,
16 "tokenization": "edgeGram",
17 "type": "autocomplete"
18 }
19 ]
20 }
21 }
22}
1{
2 "mappings": {
3 "dynamic": false,
4 "fields": {
5 "title": [
6 {
7 "type": "stringFacet"
8 },
9 {
10 "type": "string"
11 },
12 {
13 "type": "autocomplete",
14 "tokenization": "rightEdgeGram",
15 "minGrams": 3,
16 "maxGrams": 7,
17 "foldDiacritics": false
18 }
19 ]
20 }
21 }
22}
1{
2 "mappings": {
3 "dynamic": false,
4 "fields": {
5 "title": [
6 {
7 "type": "stringFacet"
8 },
9 {
10 "type": "string"
11 },
12 {
13 "type": "autocomplete",
14 "tokenization": "nGram",
15 "minGrams": 3,
16 "maxGrams": 7,
17 "foldDiacritics": false
18 }
19 ]
20 }
21 }
22}

Select your language 드롭다운 메뉴를 사용하여 이 페이지에서 예시의 언어를 설정합니다.


Search Tester에서 쿼리 구문을 보고 편집하려면 다음을 수행하세요.

1
  1. 아직 표시되지 않은 경우 탐색 표시줄의 Organizations 메뉴에서 원하는 프로젝트가 포함된 조직을 선택합니다.

  2. 아직 표시되지 않은 경우 탐색 표시줄의 Projects 메뉴에서 원하는 프로젝트를 선택합니다.

  3. 아직 표시되지 않은 경우 사이드바에서 Clusters 클릭하세요.

    Clusters(클러스터) 페이지가 표시됩니다.

2

사이드바, Data Explorer 또는 클러스터 세부 정보 페이지에서 Atlas Search 페이지로 이동할 수 있습니다.

  1. 사이드바에서 Services 제목 아래의 Atlas Search를 클릭합니다.

  2. Select data source 드롭다운에서 클러스터를 선택하고 Go to Atlas Search를 클릭합니다.

    Atlas Search 페이지가 표시됩니다.

  1. cluster의 Browse Collections 버튼을 클릭합니다.

  2. 데이터베이스를 확장하고 컬렉션을 선택합니다.

  3. 컬렉션의 Search Indexes 탭을 클릭합니다.

    Atlas Search 페이지가 표시됩니다.

  1. 클러스터 이름을 클릭합니다.

  2. Atlas Search 탭을 클릭합니다.

    Atlas Search 페이지가 표시됩니다.

3
  1. 쿼리할 인덱스 오른쪽에 있는 Query 버튼을 클릭합니다.

  2. Edit Query 을 클릭하면 JSON 형식의 기본 쿼리 구문 샘플을 볼 수 있습니다.

mongosh 프롬프트에서 다음 명령을 실행하여 sample_mflix 데이터베이스를 사용합니다.

use sample_mflix

다음 쿼리는 title 필드에 off 문자가 포함된 영화를 검색합니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "off"
}
}
}
]

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

db.movies.aggregate([
{
$search: {
"autocomplete": {
"path": "title",
"query": "off"
}
}
},
{
$limit: 10
},
{
$project: {
"_id": 0,
"title": 1
}
}
])

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"query": "off",
"path": "title"
}
}
$limit
10
$project
{
"_id": 0,
"title": 1,
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteBasicExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "off"))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id))
.Limit(10)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.D{{"query", "off"}, {"path", "title"}}}}}}
limitStage := bson.D{{"$limit", 10}}
projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"_id", 0}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import static com.mongodb.client.model.Projections.excludeId;
import static com.mongodb.client.model.Projections.fields;
import static com.mongodb.client.model.Projections.include;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteBasicExample {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete", new Document("query", "off").append("path", "title")));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(10),
project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
}
}
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search",
Document("autocomplete", Document("query", "off")
.append("path", "title"))
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(10),
project(fields(excludeId(), include("title")))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "off", path: "title"}}},
{$limit: 10},
{$project: {_id: 0,title: 1}}
];
// run pipeline
const result = await coll.aggregate(agg);
// print results
await result.forEach((doc) => console.log(doc));
} finally {
await client.close();
}
}
run().catch(console.dir);

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • title을 제외한 모든 필드를 제외하는 $project 단계

import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search": {"autocomplete": {"query": "off", "path": "title"}}},
{"$limit": 10},
{"$project": {"_id": 0, "title": 1}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 9.361787796020508 _id: "573a13b0f29313caabd355c8"
countries: Array
genres: Array
runtime: 100
...
title: "Off Beat"
SCORE: 9.068204879760742 _id: "573a13aaf29313caabd22a8c"
fullplot: "An 11-year-old girl watches her father come down with a crippling depr…"
imdb: Object
year: 2003
...
title: "Off the Map"
SCORE: 9.068204879760742 _id: "573a13bef29313caabd5d208"
plot: "With white Jewish lesbians for parents and two adopted brothers - one …"
genres: Array
runtime: 76
...
title: "Off and Running"
SCORE: 8.742463111877441 _id: "573a13bbf29313caabd5567"
countries: Array
genres: Array
runtime: 98
...
title: "Hands off Mississippi"
SCORE: 8.61273193359375 _id: "5573a1396f29313caabce4791"
plot: "Unable to deal with her parents, Jeannie Tyne runs away from home. Lar…"
genres: Array
runtime: 93
...
title: "Taking Off"
SCORE: 8.61273193359375 _id: "573a1399f29313caabced3c1"
plot: "A travelling theater group find so much action going on behind-the-sce…"
genres: Array
runtime: 101
...
title: "Noises Off..."
SCORE: 8.61273193359375 _id: "573a139af29313caabcefc73"
fullplot: "In existence for a hundred years, Grimley Colliery Brass band is as ol…"
imdb: Object
year: 1996
...
title: "Brassed Off"
SCORE: 8.61273193359375 _id: "573a139af29313caabcf08f5"
fullplot: "Sean Archer, a very tough, rugged FBI Agent. Who is still grieving for…"
imdb: Object
year: 1997
...
title: "Face/Off"
SCORE: 8.603004455566406 _id: "573a13a9f29313caabd1ea36"
fullplot: "Three unlikely, unsuspecting souls who come face-to-face with that mom…"
imdb: Object
year: 2004
...
title: "Benji: Off the Leash!"
SCORE: 7.953945159912109 _id: "573a139af29313caabcf037c"
plot: "Desperation drives four inner-city women (Queen Latifah, Jada Pinkett …"
genres: Array
runtime: 123
...
title: "Set it Off"
SCORE: 9.81808090209961 _id: "5573a1396f29313caabce4791"
plot: "Unable to deal with her parents, Jeannie Tyne runs away from home. Lar…"
genres: Array
runtime: 93
...
title: "Taking Off"
SCORE: 9.81808090209961 _id: "573a1399f29313caabced3c1"
plot: "A travelling theater group find so much action going on behind-the-sce…"
genres: Array
runtime: 101
...
title: "Noises Off..."
SCORE: 9.81808090209961 _id: "573a139af29313caabcefc73"
fullplot: "In existence for a hundred years, Grimley Colliery Brass band is as ol…"
imdb: Object
year: 1996
...
title: "Brassed Off"
SCORE: 9.81808090209961 _id: "573a139af29313caabcf08f5"
fullplot: "Sean Archer, a very tough, rugged FBI Agent. Who is still grieving for…"
imdb: Object
year: 1997
...
title: "Face/Off"
SCORE: 9.544584274291992 _id: "573a139af29313caabcf037c"
plot: "Desperation drives four inner-city women (Queen Latifah, Jada Pinkett …"
genres: Array
runtime: 123
...
title: "Set it Off"
SCORE: 9.191947937011719 _id: "573a13bbf29313caabd5567"
countries: Array
genres: Array
runtime: 98
...
title: "Hands off Mississippi"
SCORE: 9.074413299560547 _id: "573a1398f29313caabce9f28"
plot: "A high school wise guy is determined to have a day off from school, de…"
genres: Array
runtime: 103
...
title: "Ferris Bueller's Day Off"
SCORE: 9.007184982299805 _id: "573a13b0f29313caabd355c8"
countries: Array
genres: Array
runtime: 100
...
title: "Off Beat"
SCORE: 8.700296401977539 _id: "573a13a9f29313caabd1ea36"
fullplot: "Three unlikely, unsuspecting souls who come face-to-face with that mom…"
imdb: Object
year: 2004
...
title: "Benji: Off the Leash!"
SCORE: 8.33833122253418 _id: "573a13aaf29313caabd22a8c"
fullplot: "An 11-year-old girl watches her father come down with a crippling depr…"
imdb: Object
year: 2003
...
title: "Off the Map"
SCORE: 5.802560806274414 _id: “573a1396f29313caabce47f4”
countries: Array
genres: Array
runtime: 98
...
title: "Come Have Coffee with Us"
SCORE: 5.790548801422119 _id: "573a13d1f29313caabd90811"
plot: "From pagan re-enactors to failed communes, black metal festivals to Ar…"
genres: Array
runtime: 98
...
title: "A Spell to Ward Off the Darkness"
SCORE: 5.7726240158081055 _id: "573a13f3f29313caabddeb07"
plot: "Turkey in the 1960s and 70s was one of the biggest producers of film i…"
genres: Array
runtime: 96
...
title: "Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema"
SCORE: 5.749281883239746 _id: "573a13a9f29313caabd1ea36"
fullplot: "Three unlikely, unsuspecting souls who come face-to-face with that mom…"
imdb: Object
year: 2004
...
title: "Benji: Off the Leash!"
SCORE: 5.749281883239746 _id: "573a13d4f29313caabd98488"
fullplot: "This tragicomedy is a self-ironic portrait of a young man who drops ou…"
imdb: Object
year: 2012
...
title: "A Coffee in Berlin"
SCORE: 5.74220085144043 _id: “573a1397f29313caabce863f”
fullplot: "Zack Mayo is a young man who has signed up for Navy Aviation Officer C…"
imdb: Object
year: 1982
...
title: "An Officer and a Gentleman"
SCORE: 5.671174049377441 _id: “573a1398f29313caabce987c”
plot: "After the end of the Dirty War, a high school teacher sets out to find…"
genres: Array
runtime: 112
...
title: "The Official Story"
SCORE: 5.671174049377441 _id: “573a13a5f29313caabd14c36”
plot: "The first days of WWI. Adrien, a young and handsome lieutenant, is wou…"
genres: Array
runtime: 135
...
title: "The Officer's Ward"
SCORE: 5.671174049377441 _id: "573a13bbf29313caabd5567"
countries: Array
genres: Array
runtime: 98
...
title: "Hands off Mississippi"
SCORE: 5.534632682800293 _id: "573a1395f29313caabce18c9"
plot: "In this "Romeo and Juliet" inspired Cold War satire starring, written …"
genres: Array
runtime: 103
...
title: "Romanoff and Juliet"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{ title: 'Off Beat' },
2{ title: 'Off the Map' },
3{ title: 'Off and Running' },
4{ title: 'Hands off Mississippi' },
5{ title: 'Taking Off' },
6{ title: 'Noises Off...' },
7{ title: 'Brassed Off' },
8{ title: 'Face/Off' },
9{ title: 'Benji: Off the Leash!' },
10{ title: 'Set It Off' }

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{ title: 'Taking Off' }
2{ title: 'Noises Off...' }
3{ title: 'Brassed Off' }
4{ title: 'Face/Off' }
5{ title: 'Set It Off' }
6{ title: 'Hands off Mississippi' }
7{ title: "Ferris Bueller's Day Off" }
8{ title: 'Off Beat' }
9{ title: 'Benji: Off the Leash!' }
10{ title: 'Off the Map' }

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{ title: 'Come Have Coffee with Us' },
2{ title: 'A Spell to Ward Off the Darkness' },
3{ title: 'Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema' },
4{ title: 'Benji: Off the Leash!' },
5{ title: 'A Coffee in Berlin' },
6{ title: 'An Officer and a Gentleman' },
7{ title: 'The Official Story' },
8{ title: "The Officer's Ward" },
9{ title: 'Hands off Mississippi' },
10{ title: 'Romanoff and Juliet' }

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1{ title: 'Off Beat' },
2{ title: 'Off the Map' },
3{ title: 'Off and Running' },
4{ title: 'Hands off Mississippi' },
5{ title: 'Taking Off' },
6{ title: 'Noises Off...' },
7{ title: 'Brassed Off' },
8{ title: 'Face/Off' },
9{ title: 'Benji: Off the Leash!' },
10{ title: 'Set It Off' }

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{ title: 'Taking Off' }
2{ title: 'Noises Off...' }
3{ title: 'Brassed Off' }
4{ title: 'Face/Off' }
5{ title: 'Set It Off' }
6{ title: 'Hands off Mississippi' }
7{ title: "Ferris Bueller's Day Off" }
8{ title: 'Off Beat' }
9{ title: 'Benji: Off the Leash!' }
10{ title: 'Off the Map' }

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{ title: 'Come Have Coffee with Us' },
2{ title: 'A Spell to Ward Off the Darkness' },
3{ title: 'Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema' },
4{ title: 'Benji: Off the Leash!' },
5{ title: 'A Coffee in Berlin' },
6{ title: 'An Officer and a Gentleman' },
7{ title: 'The Official Story' },
8{ title: "The Officer's Ward" },
9{ title: 'Hands off Mississippi' },
10{ title: 'Romanoff and Juliet' }

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1{ "title": "Off Beat" }
2{ "title": "Off the Map" }
3{ "title": "Off and Running" }
4{ "title": "Hands off Mississippi" }
5{ "title": "Taking Off" }
6{ "title": "Noises Off..." }
7{ "title": "Brassed Off" }
8{ "title": "Face/Off" }
9{ "title": "Benji: Off the Leash!" }
10{ "title": "Set It Off" }

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{ "title" : "Taking Off" }
2{ "title" : "Noises Off..." }
3{ "title" : "Brassed Off" }
4{ "title" : "Face/Off" }
5{ "title" : "Set It Off" }
6{ "title" : "Hands off Mississippi" }
7{ "title" : "Ferris Bueller's Day Off" }
8{ "title" : "Off Beat" }
9{ "title" : "Benji: Off the Leash!" }
10{ "title" : "Off the Map" }

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{ "title" : "Come Have Coffee with Us" }
2{ "title" : "A Spell to Ward Off the Darkness" }
3{ "title" : "Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema" }
4{ "title" : "Benji: Off the Leash!" }
5{ "title" : "A Coffee in Berlin" }
6{ "title" : "An Officer and a Gentleman" }
7{ "title" : "The Official Story" }
8{ "title" : "The Officer's Ward" }
9{ "title" : "Hands off Mississippi" }
10{ "title" : "Romanoff and Juliet" }

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1[{title Off Beat}]
2[{title Off the Map}]
3[{title Off and Running}]
4[{title Hands off Mississippi}]
5[{title Taking Off}]
6[{title Noises Off...}]
7[{title Brassed Off}]
8[{title Face/Off}]
9[{title Benji: Off the Leash!}]
10[{title Set It Off}]

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1[{title Taking Off}]
2[{title Noises Off...}]
3[{title Brassed Off}]
4[{title Face/Off}]
5[{title Set It Off}]
6[{title Hands off Mississippi}]
7[{title Ferris Bueller's Day Off}]
8[{title Off Beat}]
9[{title Benji: Off the Leash!}]
10[{title Off the Map}]

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1[{title Come Have Coffee with Us}]
2[{title A Spell to Ward Off the Darkness}]
3[{title Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema}]
4[{title Benji: Off the Leash!}]
5[{title A Coffee in Berlin}]
6[{title An Officer and a Gentleman}]
7[{title The Official Story}]
8[{title The Officer's Ward}]
9[{title Hands off Mississippi}]
10[{title Romanoff and Juliet}]

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1{"title": "Off Beat"}
2{"title": "Off the Map"}
3{"title": "Off and Running"}
4{"title": "Hands off Mississippi"}
5{"title": "Taking Off"}
6{"title": "Noises Off..."}
7{"title": "Brassed Off"}
8{"title": "Face/Off"}
9{"title": "Benji: Off the Leash!"}
10{"title": "Set It Off"}

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{"title": "Taking Off"}
2{"title": "Noises Off..."}
3{"title": "Brassed Off"}
4{"title": "Face/Off"}
5{"title": "Set It Off"}
6{"title": "Hands off Mississippi"}
7{"title": "Ferris Bueller's Day Off"}
8{"title": "Off Beat"}
9{"title": "Benji: Off the Leash!"}
10{"title": "Off the Map"}

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{"title": "Come Have Coffee with Us"}
2{"title": "A Spell to Ward Off the Darkness"}
3{"title": "Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema"}
4{"title": "Benji: Off the Leash!"}
5{"title": "A Coffee in Berlin"}
6{"title": "An Officer and a Gentleman"}
7{"title": "The Official Story"}
8{"title": "The Officer's Ward"}
9{"title": "Hands off Mississippi"}
10{"title": "Romanoff and Juliet"}

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1Document{{title=Off Beat}}
2Document{{title=Off the Map}}
3Document{{title=Off and Running}}
4Document{{title=Hands off Mississippi}}
5Document{{title=Taking Off}}
6Document{{title=Face/Off}}
7Document{{title=Noises Off...}}
8Document{{title=Brassed Off}}
9Document{{title=Benji: Off the Leash!}}
10Document{{title=Set It Off}}

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1Document{{title=Noises Off...}}
2Document{{title=Taking Off}}
3Document{{title=Brassed Off}}
4Document{{title=Face/Off}}
5Document{{title=Set It Off}}
6Document{{title=Hands off Mississippi}}
7Document{{title=Ferris Bueller's Day Off}}
8Document{{title=Off Beat}}
9Document{{title=Benji: Off the Leash!}}
10Document{{title=Off and Running}}

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1Document{{title=Taking Off}}
2Document{{title=Noises Off...}}
3Document{{title=Brassed Off}}
4Document{{title=Face/Off}}
5Document{{title=Off Beat}}
6Document{{title=Hands off Mississippi}}
7Document{{title=Off the Map}}
8Document{{title=Set It Off}}
9Document{{title=Off and Running}}
10Document{{title=Benji: Off the Leash!}}

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1{ title: 'Off Beat' }
2{ title: 'Off the Map' }
3{ title: 'Off and Running' }
4{ title: 'Hands off Mississippi' }
5{ title: 'Taking Off' }
6{ title: 'Noises Off...' }
7{ title: 'Brassed Off' }
8{ title: 'Face/Off' }
9{ title: 'Benji: Off the Leash!' }
10{ title: 'Set It Off' }

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{ title: 'Taking Off' }
2{ title: 'Noises Off...' }
3{ title: 'Brassed Off' }
4{ title: 'Face/Off' }
5{ title: 'Set It Off' }
6{ title: 'Hands off Mississippi' }
7{ title: "Ferris Bueller's Day Off" }
8{ title: 'Off Beat' }
9{ title: 'Benji: Off the Leash!' }
10{ title: 'Off the Map' }

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{ title: 'Come Have Coffee with Us' }
2{ title: 'A Spell to Ward Off the Darkness' }
3{ title: 'Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema' }
4{ title: 'Benji: Off the Leash!' }
5{ title: 'A Coffee in Berlin' }
6{ title: 'An Officer and a Gentleman' }
7{ title: 'The Official Story' }
8{ title: "The Officer's Ward" }
9{ title: 'Hands off Mississippi' }
10{ title: 'Romanoff and Juliet' }

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

1{'title': 'Off Beat'}
2{'title': 'Off the Map'}
3{'title': 'Off and Running'}
4{'title': 'Hands off Mississippi'}
5{'title': 'Taking Off'}
6{'title': 'Noises Off...'}
7{'title': 'Brassed Off'}
8{'title': 'Face/Off'}
9{'title': 'Benji: Off the Leash!'}
10{'title': 'Set It Off'}

위 결과에서는 모든 제목의 단어 왼쪽에 off 문자가 나타납니다.

1{'title': 'Taking Off'}
2{'title': 'Noises Off...'}
3{'title': 'Brassed Off'}
4{'title': 'Face/Off'}
5{'title': 'Set It Off'}
6{'title': 'Hands off Mississippi'}
7{'title': "Ferris Bueller's Day Off"}
8{'title': 'Off Beat'}
9{'title': 'Benji: Off the Leash!'}
10{'title': 'Off the Map'}

위 결과에서는 모든 제목의 단어 오른쪽에 off 문자가 나타납니다.

1{'title': 'Come Have Coffee with Us'}
2{'title': 'A Spell to Ward Off the Darkness'}
3{'title': 'Remake, Remix, Rip-Off: About Copy Culture & Turkish Pop Cinema'}
4{'title': 'Benji: Off the Leash!'}
5{'title': 'A Coffee in Berlin'}
6{'title': 'An Officer and a Gentleman'}
7{'title': 'The Official Story'}
8{'title': "The Officer's Ward"}
9{'title': 'Hands off Mississippi'}
10{'title': 'Romanoff and Juliet'}

위의 결과에서 off 문자는 제목의 다른 위치에 나타납니다.

다음 쿼리는 title 필드에 pre 문자가 포함된 영화를 검색합니다. 쿼리는 다음을 사용합니다.

필드
설명
maxEdits
쿼리를 문서의 단어와 일치시키기 위해 쿼리 문자열 pre에 하나의 문자 변형만 허용됨을 나타냅니다.
prefixLength
쿼리를 문서의 단어와 일치시킬 때 쿼리 문자열 pre 의 첫 번째 문자가 변경될 수 없음을 나타냅니다.
maxExpansions
쿼리 문자열을 문서의 단어와 일치시킬 때 pre에 대해 최대 256개의 유사한 용어를 고려할 수 있음을 나타냅니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "pre",
fuzzy: {
maxEdits: 1,
prefixLength: 1,
maxExpansions: 256
}
}
}
}
]
db.movies.aggregate([
{
$search: {
"autocomplete": {
"path": "title",
"query": "pre",
"fuzzy": {
"maxEdits": 1,
"prefixLength": 1,
"maxExpansions": 256
}
}
}
},
{
$limit: 10
},
{
$project: {
"_id": 0,
"title": 1
}
}
])

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"query": "pre",
"path": "title",
"fuzzy": {
"maxEdits": 1,
"prefixLength": 1,
"maxExpansions": 256
}
}
}
$limit
10
$project
{
"_id": 0,
"title": 1,
}
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteFuzzyExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define fuzzy options
SearchFuzzyOptions fuzzyOptions = new SearchFuzzyOptions()
{
MaxEdits = 1,
PrefixLength = 1,
MaxExpansions = 256
};
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "pre", fuzzy: fuzzyOptions))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id))
.Limit(10)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
}
package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.D{{"query", "pre"}, {"path", "title"}, {"fuzzy", bson.D{{"maxEdits", 1},{"prefixLength", 1},{"maxExpansions", 256}}}}}}}}
limitStage := bson.D{{"$limit", 10}}
projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"_id", 0}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}
import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import static com.mongodb.client.model.Projections.excludeId;
import static com.mongodb.client.model.Projections.fields;
import static com.mongodb.client.model.Projections.include;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteFuzzyExample {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete",
new Document("query", "pre")
.append("path", "title")
.append("fuzzy", new Document("maxEdits", 1).append("prefixLength", 1).append("maxExpansions", 256))));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(10),
project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
}
}
}
import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search",
Document("autocomplete", Document("query", "pre")
.append("path", "title")
.append("fuzzy", Document("maxEdits", 1)
.append("prefixLength", 1)
.append("maxExpansions", 256))
)
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(10),
project(fields(excludeId(), include("title")))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}
const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "pre", path: "title", fuzzy: {"maxEdits": 1, "prefixLength": 1, "maxExpansions": 256}}}},
{$limit: 10},
{$project: {_id: 0,title: 1}}
];
// run pipeline
const result = await coll.aggregate(agg);
// print results
await result.forEach((doc) => console.log(doc));
} finally {
await client.close();
}
}
run().catch(console.dir);
import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search": {"autocomplete": {"query": "pre", "path": "title", "fuzzy": {"maxEdits": 1, "prefixLength": 1, "maxExpansions": 256}}}},
{"$limit": 10},
{"$project": {"_id": 0, "title": 1}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 1 _id: “573a1390f29313caabcd5293”
plot: "Young Pauline is left a lot of money when her wealthy uncle dies. Howe…"
genres: Array
runtime: 199
...
title: "The Perils of Pauline"
SCORE: 1 _id: “573a1391f29313caabcd9458”
plot: "A young artist draws a face at a canvas on his easel. Suddenly the mou…"
genres: Array
rated: "UNRATED"
...
title: "The Blood of a Poet"
SCORE: 1 _id: “573a1392f29313caabcda09b”
plot: "Tells how King Henry VIII came to marry five more times after his divo…"
genres: Array
runtime: 97
...
title: "The Private Life of Henry VIII."
SCORE: 1 _id: “573a1392f29313caabcda556”
plot: "What do women want? Don Juan is aging. He's arrived secretly in Sevill…"
genres: Array
runtime: 89
...
title: "The Private Life of Don Juan"
SCORE: 1 _id: “573a1392f29313caabcdaee0”
plot: "The story of Dr. Samuel Mudd, who was imprisoned after innocently trea…"
genres: Array
runtime: 96
...
title: "The Prisoner of Shark Island"
SCORE: 1 _id: “573a1392f29313caabcdb3f2”
plot: "Two lookalike boys, one a poor street kid and the other a prince, exch…"
genres: Array
runtime: 118
...
title: "The Prince and the Pauper"
SCORE: 1 _id: “573a1392f29313caabcdb3f4”
plot: "An Englishman on a Ruritarian holiday must impersonate the king when t…"
genres: Array
runtime: 101
...
title: "The Prisoner of Zenda"
SCORE: 1 _id: “573a1392f29313caabcdb505”
plot: "After the death of her husband, Christine realizes she has possibly wa…"
genres: Array
runtime: 144
...
title: "Dance Program"
SCORE: 1 _id: “573a1393f29313caabcdca58”
plot: "While traveling in France during the Nazi invasion of 1940, an English…"
genres: Array
runtime: 87
...
title: "The Pied Piper"
SCORE: 1 _id: “573a1393f29313caabcdca76”
plot: "The official World War II US Government film statement defining the va…"
genres: Array
runtime: 87
...
title: "Prelude to War"
SCORE: 1 _id: “573a1390f29313caabcd5ea4”
plot: "A District Attorney's outspoken stand on abortion gets him in trouble …"
genres: Array
runtime: 62
...
title: "Where Are My Children?"
SCORE: 1 _id: “573a1391f29313caabcd70b4”
plot: "An extended family split up in France and Germany find themselves on o…"
genres: Array
runtime: 150
...
title: "The Four Horsemen of the Apocalypse"
SCORE: 1 _id: “573a1391f29313caabcd7850”
plot: "In fifteenth century Paris, the brother of the archdeacon plots with t…"
genres: Array
runtime: 133
...
title: "The Hunchback of Notre Dame"
SCORE: 1 _id: “573a1391f29313caabcd8cbd”
plot: "A young lady from Georgia goes to Hollywood in the hopes of becoming a…"
genres: Array
runtime: 83
...
title: "Show People"
SCORE: 1 _id: “573a1392f29313caabcd9df7”
plot: "A young American man is transported back to London in the time of the …"
genres: Array
runtime: 84
...
title: "Berkeley Square"
SCORE: 1 _id: “573a1392f29313caabcda7fb”
plot: "An entertainer impersonates a look-alike banker, causing comic confusi…"
genres: Array
runtime: 82
...
title: "Folies Bergère de Paris"
SCORE: 1 _id: “573a1393f29313caabcdc4a2”
plot: "Boxer Joe Pendleton dies 50 years too soon due to a heavenly mistake, …"
genres: Array
runtime: 94
...
title: "Here Comes Mr. Jordan"
SCORE: 1 _id: “573a1393f29313caabcdc814”
plot: "An American man marries a Serbian immigrant who fears that she will tu…"
genres: Array
runtime: 73
...
title: "Cat People"
SCORE: 1 _id: “573a1393f29313caabcdc87b”
plot: "Mail author for translation. Kodos hegycsucsok, fekete fenyvesek vilag…"
genres: Array
runtime: 88
...
title: "People on the Alps"
SCORE: 1 _id: “573a1393f29313caabcdcd39”
plot: "A soldier falls for a chorus girl and then experiences trouble when he…"
genres: Array
runtime: 103
...
title: "The Gang's All Here"
SCORE: 1 _id: “573a1390f29313caabcd5293”
plot: "Young Pauline is left a lot of money when her wealthy uncle dies. Howe…"
genres: Array
runtime: 199
...
title: "The Perils of Pauline"
SCORE: 1 _id: “573a1390f29313caabcd5967”
plot: "An intrepid reporter and his loyal friend battle a bizarre secret soci…"
genres: Array
runtime: 399
...
title: "Les vampires"
SCORE: 1 _id: “573a1391f29313caabcd6ea2”
plot: "The simple-minded son of a rich financier must find his own way in the…"
genres: Array
runtime: 77
...
title: "The Saphead"
SCORE: 1 _id: “573a1391f29313caabcd70b4”
plot: "An extended family split up in France and Germany find themselves on o…"
genres: Array
runtime: 150
...
title: "The Four Horsemen of the Apocalypse"
SCORE: 1 _id: “573a1391f29313caabcd7b98”
plot: "A bitter clown endeavors to rescue the young woman he loves from the l…"
genres: Array
runtime: 95
...
title: "He Who Gets Slapped"
SCORE: 1 _id: “573a1391f29313caabcd806b”
plot: "A mad, disfigured composer seeks love with a lovely young opera singer…"
genres: Array
runtime: 93
...
title: "The Phantom of the Opera"
SCORE: 1 _id: “573a1391f29313caabcd8cbd”
plot: "A young lady from Georgia goes to Hollywood in the hopes of becoming a…"
genres: Array
runtime: 83
...
title: "Show People"
SCORE: 1 _id: “573a1391f29313caabcd9458”
plot: "A young artist draws a face at a canvas on his easel. Suddenly the mou…"
genres: Array
rated: "UNRATED"
...
title: "The Blood of a Poet"
SCORE: 1 _id: “573a1391f29313caabcd9651”
plot: "In London at the turn of the century, the bandit Mack the Knife marrie…"
genres: Array
runtime: 112
...
title: "The 3 Penny Opera"
SCORE: 1 _id: “573a1392f29313caabcd9caa”
plot: "Many passengers on the Shanghai Express are more concerned that the no…"
genres: Array
runtime: 82
...
title: "Shanghai Express"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{ title: 'The Perils of Pauline' },
2{ title: 'The Blood of a Poet' },
3{ title: 'The Private Life of Henry VIII.' },
4{ title: 'The Private Life of Don Juan' },
5{ title: 'The Prisoner of Shark Island' },
6{ title: 'The Prince and the Pauper' },
7{ title: 'The Prisoner of Zenda' },
8{ title: 'Dance Program' },
9{ title: 'The Pied Piper' },
10{ title: 'Prelude to War' }

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'Where Are My Children?' }
2{ title: 'The Four Horsemen of the Apocalypse' }
3{ title: 'The Hunchback of Notre Dame' }
4{ title: 'Show People' }
5{ title: 'Berkeley Square' }
6{ title: 'Folies Bergère de Paris' }
7{ title: 'Here Comes Mr. Jordan' }
8{ title: 'Cat People' }
9{ title: 'People on the Alps' }
10{ title: "The Gang's All Here" }

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'The Perils of Pauline' }
2{ title: 'Les vampires' }
3{ title: 'The Saphead' }
4{ title: 'The Four Horsemen of the Apocalypse' }
5{ title: 'He Who Gets Slapped' }
6{ title: 'The Phantom of the Opera' }
7{ title: 'Show People' }
8{ title: 'The Blood of a Poet' }
9{ title: 'The 3 Penny Opera' }
10{ title: 'Shanghai Express' }

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'The Perils of Pauline' },
2{ title: 'The Blood of a Poet' },
3{ title: 'The Private Life of Henry VIII.' },
4{ title: 'The Private Life of Don Juan' },
5{ title: 'The Prisoner of Shark Island' },
6{ title: 'The Prince and the Pauper' },
7{ title: 'The Prisoner of Zenda' },
8{ title: 'Dance Program' },
9{ title: 'The Pied Piper' },
10{ title: 'Prelude to War' }

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'Where Are My Children?' }
2{ title: 'The Four Horsemen of the Apocalypse' }
3{ title: 'The Hunchback of Notre Dame' }
4{ title: 'Show People' }
5{ title: 'Berkeley Square' }
6{ title: 'Folies Bergère de Paris' }
7{ title: 'Here Comes Mr. Jordan' }
8{ title: 'Cat People' }
9{ title: 'People on the Alps' }
10{ title: "The Gang's All Here" }

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'The Perils of Pauline' }
2{ title: 'Les vampires' }
3{ title: 'The Saphead' }
4{ title: 'The Four Horsemen of the Apocalypse' }
5{ title: 'He Who Gets Slapped' }
6{ title: 'The Phantom of the Opera' }
7{ title: 'Show People' }
8{ title: 'The Blood of a Poet' }
9{ title: 'The 3 Penny Opera' }
10{ title: 'Shanghai Express' }

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ "title" : "The Perils of Pauline" }
2{ "title" : "The Blood of a Poet" }
3{ "title" : "The Private Life of Henry VIII." }
4{ "title" : "The Private Life of Don Juan" }
5{ "title" : "The Prisoner of Shark Island" }
6{ "title" : "The Prince and the Pauper" }
7{ "title" : "The Prisoner of Zenda" }
8{ "title" : "Dance Program" }
9{ "title" : "The Pied Piper" }
10{ "title" : "Prelude to War" }

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ "title" : "Where Are My Children?" }
2{ "title" : "The Four Horsemen of the Apocalypse" }
3{ "title" : "The Hunchback of Notre Dame" }
4{ "title" : "Show People" }
5{ "title" : "Berkeley Square" }
6{ "title" : "Folies Bergère de Paris" }
7{ "title" : "Here Comes Mr. Jordan" }
8{ "title" : "Cat People" }
9{ "title" : "People on the Alps" }
10{ "title" : "The Gang's All Here" }

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ "title" : "The Perils of Pauline" }
2{ "title" : "Les vampires" }
3{ "title" : "The Saphead" }
4{ "title" : "The Four Horsemen of the Apocalypse" }
5{ "title" : "He Who Gets Slapped" }
6{ "title" : "The Phantom of the Opera" }
7{ "title" : "Show People" }
8{ "title" : "The Blood of a Poet" }
9{ "title" : "The 3 Penny Opera" }
10{ "title" : "Shanghai Express" }

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1[{title The Perils of Pauline}]
2[{title The Blood of a Poet}]
3[{title The Private Life of Henry VIII.}]
4[{title The Private Life of Don Juan}]
5[{title The Prisoner of Shark Island}]
6[{title The Prince and the Pauper}]
7[{title The Prisoner of Zenda}]
8[{title Dance Program}]
9[{title The Pied Piper}]
10[{title Prelude to War}]

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1[{title Where Are My Children?}]
2[{title The Four Horsemen of the Apocalypse}]
3[{title The Hunchback of Notre Dame}]
4[{title Show People}]
5[{title Berkeley Square}]
6[{title Folies Bergère de Paris}]
7[{title Here Comes Mr. Jordan}]
8[{title Cat People}]
9[{title People on the Alps}]
10[{title The Gang's All Here}]

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1[{title The Perils of Pauline}]
2[{title Les vampires}]
3[{title The Saphead}]
4[{title The Four Horsemen of the Apocalypse}]
5[{title He Who Gets Slapped}]
6[{title The Phantom of the Opera}]
7[{title Show People}]
8[{title The Blood of a Poet}]
9[{title The 3 Penny Opera}]
10[{title Shanghai Express}]

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{"title": "The Perils of Pauline"}
2{"title": "The Blood of a Poet"}
3{"title": "The Private Life of Henry VIII."}
4{"title": "The Private Life of Don Juan"}
5{"title": "The Prisoner of Shark Island"}
6{"title": "The Prince and the Pauper"}
7{"title": "The Prisoner of Zenda"}
8{"title": "Dance Program"}
9{"title": "The Pied Piper"}
10{'title': 'Prelude to War'}

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{"title": "Where Are My Children?"}
2{"title": "The Four Horsemen of the Apocalypse"}
3{"title": "The Hunchback of Notre Dame"}
4{"title": "Show People"}
5{"title": "Berkeley Square"}
6{"title": "Folies Bergère de Paris"}
7{"title": "Here Comes Mr. Jordan"}
8{"title": "Cat People"}
9{"title": "People on the Alps"}
10{"title": "The Gang's All Here"}

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{"title": "The Perils of Pauline"}
2{"title": "Les vampires"}
3{"title": "The Saphead"}
4{"title": "The Four Horsemen of the Apocalypse"}
5{"title": "He Who Gets Slapped"}
6{"title": "The Phantom of the Opera"}
7{"title": "Show People"}
8{"title": "The Blood of a Poet"}
9{"title": "The 3 Penny Opera"}
10{"title": "Shanghai Express"}

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1Document{{title=The Perils of Pauline}}
2Document{{title=The Private Life of Henry VIII.}}
3Document{{title=Prelude to War}}
4Document{{title=Sitting Pretty}}
5Document{{title=The Prisoner}}
6Document{{title=Chi lavora è perduto (In capo al mondo)}}
7Document{{title=Profound Desires of the Gods}}
8Document{{title=The Protagonists}}
9Document{{title=Property Is No Longer a Theft}}
10Document{{title=Premiya}}

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1Document{{title=The Four Horsemen of the Apocalypse}}
2Document{{title=Folies Bergère de Paris}}
3Document{{title=Mother Wore Tights}}
4Document{{title=El hombre sin rostro}}
5Document{{title=Il segno di Venere}}
6Document{{title=Creature from the Black Lagoon}}
7Document{{title=Susan Slept Here}}
8Document{{title=Tell Them Willie Boy Is Here}}
9Document{{title=Pilatus und andere - Ein Film fèr Karfreitag}}
10Document{{title=Watch Out, We're Mad}}

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1Document{{title=The Four Horsemen of the Apocalypse}}
2Document{{title=The Private Life of Henry VIII.}}
3Document{{title=David Copperfield}}
4Document{{title=The Prisoner of Zenda}}
5Document{{title=People on the Alps}}
6Document{{title=Prelude to War}}
7Document{{title=The Pride of the Yankees}}
8Document{{title=Phantom of the Opera}}
9Document{{title=The Curse of the Cat People}}
10Document{{title=The People Against O'Hara}}

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'The Perils of Pauline' }
2{ title: 'The Blood of a Poet' }
3{ title: 'The Private Life of Henry VIII.' }
4{ title: 'The Private Life of Don Juan' }
5{ title: 'The Prisoner of Shark Island' }
6{ title: 'The Prince and the Pauper' }
7{ title: 'The Prisoner of Zenda' }
8{ title: 'Dance Program' }
9{ title: 'The Pied Piper' }
10{ title: 'Prelude to War' }

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'Where Are My Children?' }
2{ title: 'The Four Horsemen of the Apocalypse' }
3{ title: 'The Hunchback of Notre Dame' }
4{ title: 'Show People' }
5{ title: 'Berkeley Square' }
6{ title: 'Folies Bergère de Paris' }
7{ title: 'Here Comes Mr. Jordan' }
8{ title: 'Cat People' }
9{ title: 'People on the Alps' }
10{ title: "The Gang's All Here" }

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{ title: 'The Perils of Pauline' }
2{ title: 'Les vampires' }
3{ title: 'The Saphead' }
4{ title: 'The Four Horsemen of the Apocalypse' }
5{ title: 'He Who Gets Slapped' }
6{ title: 'The Phantom of the Opera' }
7{ title: 'Show People' }
8{ title: 'The Blood of a Poet' }
9{ title: 'The 3 Penny Opera' }
10{ title: 'Shanghai Express' }

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{'title': 'The Perils of Pauline'}
2{'title': 'The Blood of a Poet'}
3{'title': 'The Private Life of Henry VIII.'}
4{'title': 'The Private Life of Don Juan'}
5{'title': 'The Prisoner of Shark Island'}
6{'title': 'The Prince and the Pauper'}
7{'title': 'The Prisoner of Zenda'}
8{'title': 'Dance Program'}
9{'title': 'The Pied Piper'}
10{'title': 'Prelude to War'}

이 결과는 모든 제목의 단어 왼쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{'title': 'Where Are My Children?'}
2{'title': 'The Four Horsemen of the Apocalypse'}
3{'title': 'The Hunchback of Notre Dame'}
4{'title': 'Show People'}
5{'title': 'Berkeley Square'}
6{'title': 'Folies Bergère de Paris'}
7{'title': 'Here Comes Mr. Jordan'}
8{'title': 'Cat People'}
9{'title': 'People on the Alps'}
10{'title': "The Gang's All Here"}

이 결과는 모든 제목의 단어 오른쪽에 첫 번째 문자 상수를 사용하여 한 글자 수정을 사용하여 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

1{'title': 'The Perils of Pauline'}
2{'title': 'Les vampires'}
3{'title': 'The Saphead'}
4{'title': 'The Four Horsemen of the Apocalypse'}
5{'title': 'He Who Gets Slapped'}
6{'title': 'The Phantom of the Opera'}
7{'title': 'Show People'}
8{'title': 'The Blood of a Poet'}
9{'title': 'The 3 Penny Opera'}
10{'title': 'Shanghai Express'}

이 결과는 제목에 있는 단어의 다른 위치에서 한 문자가 수정된 쿼리 문자열에 대해 예측된 단어를 보여줍니다.

다음 쿼리는 title 필드에 men with 문자가 포함된 영화를 검색합니다. 이 쿼리는 또한 tokenOrder 필드를 사용하여 쿼리가 토큰을 any 순서로 검색할지 또는 sequential 순서로 검색할지를 지정합니다.

키워드 분석기로 필드를 인덱싱하여 title 필드에서 단어나 문구로 시작하는 영화 제목을 검색할 수 있습니다.

다음 샘플 쿼리의 결과를 조회하려면 edgeGram 토큰화 전략과 함께 키워드 분석기를 사용하여 필드를 인덱싱해야 합니다. 다른 내장 분석기를 사용하여 필드를 인덱싱하는 경우 Atlas Search는 텍스트 필드를 단일 단어로 인덱싱하지 않기 때문에 결과를 반환하지 않습니다. edgeGram 토큰화 전략은 단어의 왼쪽에서 시작하여 토큰을 생성합니다.

대소문자를 구분하지 않는 결과를 반환하려면 foldDiacritics을(를) true(으)로 설정해야 합니다. foldDiacritics을(를) false(으)로 설정한 경우 Atlas Search에서 결과를 반환하려면 검색어의 대소문자가 문서의 대소문자와 정확히 일치해야 합니다.

{
"mappings": {
"dynamic": false,
"fields": {
"title": [
{
"type": "stringFacet"
},
{
"type": "string"
},
{
"foldDiacritics": true,
"maxGrams": 7,
"minGrams": 3,
"analyzer": "lucene.keyword",
"tokenization": "edgeGram",
"type": "autocomplete"
}]
}
}
}

다음 쿼리는 Fast & 단어로 시작하는 영화 제목을 검색합니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "Fast &",
tokenOrder: "sequential"
}
}
}
]

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

db.movies.aggregate([
{
$search: {
"autocomplete": {
"query": "Fast &",
"path": "title",
"tokenOrder": "sequential"
}
}
},
{
$project: {
"_id": 0,
"title": 1
}
},
{
$limit: 4
}
])

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"query": "Fast &",
"path": "title",
"tokenOrder": "sequential"
}
}
$limit
4
$project
{
"_id": 0,
"title": 1,
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteTokenOrderSequentialStartsWithExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "Fast &", SearchAutocompleteTokenOrder.Sequential))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id))
.Limit(4)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.D{{"query", "Fast &"}, {"path", "title"}, {"tokenOrder", "sequential"}}}}}}
limitStage := bson.D{{"$limit", 4}}
projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"_id", 0}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import static com.mongodb.client.model.Projections.excludeId;
import static com.mongodb.client.model.Projections.fields;
import static com.mongodb.client.model.Projections.include;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteStartsWith {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete", new Document("query", "Fast &").append("path", "title").append("tokenOrder", "sequential")));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(4),
project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
}
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search",
Document(
"autocomplete",
Document("query", "Fast &")
.append("path", "title")
.append("tokenOrder", "sequential")
)
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(4),
project(fields(excludeId(), include("title")))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "Fast &", path: "title", tokenOrder: "sequential"}}},
{$limit: 4},
{$project: {_id: 0,title: 1}}
];
// run pipeline
const result = await coll.aggregate(agg);
// print results
await result.forEach((doc) => console.log(doc));
} finally {
await client.close();
}
}
run().catch(console.dir);

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search": {"autocomplete": {"query": "men with", "path": "title", "tokenOrder": "sequential"}}},
{"$limit": 4},
{"$project": {"_id": 0, "title": 1}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)
SCORE: 10.042893409729004 _id: “573a13bdf29313caabd5929f”
fullplot: "Heading back to the streets where it all began, two men rejoin two wom…"
imdb: Object
year: 2009
...
title: "Fast & Furious"
SCORE: 9.515419006347656 _id: “573a13d3f29313caabd95cc5”
fullplot: "Since Dom (Diesel) and Brian's (Walker) Rio heist toppled a kingpin's …"
imdb: Object
year: 2013
...
title "Fast & Furious 6"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{ title: 'Fast & Furious' },
2{ title: 'Fast & Furious 6' }
1{ title: 'Fast & Furious' },
2{ title: 'Fast & Furious 6' }
1{ "title" : "Fast & Furious" }
2{ "title" : "Fast & Furious 6" }
1 [{title Fast & Furious}]
2 [{title Fast & Furious 6}]
1{"title": "Fast & Furious"}
2{"title": "Fast & Furious 6"}
1Document{{title=Fast & Furious}}
2Document{{title=Fast & Furious 6}}
1{ title: 'Fast & Furious' }
2{ title: 'Fast & Furious 6' }
1{'title': 'Fast & Furious'}
2{'title': 'Fast & Furious 6'}

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "men with",
tokenOrder: "any"
}
}
}
]

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

db.movies.aggregate([
{
$search: {
"autocomplete": {
"path": "title",
"query": "men with",
"tokenOrder": "any"
}
}
},
{
$limit: 4
},
{
$project: {
"_id": 0,
"title": 1
}
}
])

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"query": "men with",
"path": "title",
"tokenOrder": "any"
}
}
$limit
4
$project
{
"_id": 0,
"title": 1,
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteTokenOrderAnyExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "men with", SearchAutocompleteTokenOrder.Any))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id))
.Limit(4)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.D{{"query", "men with"}, {"path", "title"}, {"tokenOrder", "any"}}}}}}
limitStage := bson.D{{"$limit", 4}}
projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"_id", 0}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import static com.mongodb.client.model.Projections.excludeId;
import static com.mongodb.client.model.Projections.fields;
import static com.mongodb.client.model.Projections.include;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteTokenAny {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete", new Document("query", "men with").append("path", "title").append("tokenOrder", "any")));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(4),
project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
}
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search",
Document("autocomplete", Document("query", "men with")
.append("path", "title")
.append("tokenOrder", "any"))
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(4),
project(fields(excludeId(), include("title")))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "men with", path: "title", tokenOrder: "any"}}},
{$limit: 4},
{$project: {_id: 0,title: 1}}
];
// run pipeline
const result = await coll.aggregate(agg);
// print results
await result.forEach((doc) => console.log(doc));
} finally {
await client.close();
}
}
run().catch(console.dir);

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search": {"autocomplete": {"query": "men with", "path": "title", "tokenOrder": "any"}}},
{"$limit": 4},
{"$project": {"_id": 0, "title": 1}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 21.18158721923828 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 21.18158721923828 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 19.015962600708008 _id: “573a1391f29313caabcd93a3”
plot: "Navy divers clear the torpedo tube of a sunken submarine."
genres: Array
runtime: 77
...
title: "Men Without Women"
SCORE: 11.215812683105469 _id: “573a13b8f29313caabd4bcbf”
plot: "A graduate student (Nicholson) copes with a recent breakup by conducti…"
genres: Array
runtime: 80
...
title: "Brief Interviews with Hideous Men"
SCORE: 10.668076515197754 _id: “573a13c9f29313caabd7ba99”
plot: "The women of a remote Latin American town are forced to pick up the pi…""
genres: Array
runtime: 87
...
title: "Without Men"
SCORE: 10.106664657592773 _id: “573a13c8f29313caabd77ab6”
plot: "Against the tumultuous backdrop of Iran's 1953 CIA-backed coup d'ètat,…"
genres: Array
runtime: 95
...
title: "Women Without Men"
SCORE: 7.458737373352051 _id: “573a1398f29313caabce9a19”
plot: "A man's wife leaves him to take up with an artist, so the man responds…"
genres: Array
runtime: 99
...
title: "Men..."
SCORE: 7.405402183532715 _id: “573a13f2f29313caabdde0b4”
plot: "Men and Chicken is a black comedy about two outcast brothers, who by g…"
genres: Array
runtime: 104
...
title: "Men & Chicken"
SCORE: 7.2005205154418945 _id: “573a1394f29313caabce06c3”
plot: "During the Korean War, a battle worn Lt. and his platoon behind enemy …"
genres: Array
runtime: 102
...
title: "Men in War"
SCORE: 7.2005205154418945 _id: “573a1399f29313caabcec167”
plot: "A mother of two sons finds life considerably difficult on her own afte…"
genres: Array
runtime: 115
...
title: "Men Don't Leave"
SCORE: 19.302995681762695 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 19.302995681762695 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 13.835155487060547 _id: “573a1399f29313caabcee64e”
plot: "A thief's son cons his father into spending more time with him."
genres: Array
runtime: 109
...
title: "Getting Even with Dad"
SCORE: 13.309324264526367 _id: “573a13cdf29313caabd844f5”
plot: "Since his beloved violin was broken, Nasser Ali Khan, one of the most …"
genres: Array
runtime: 93
...
title: "Chicken with Plums"
SCORE: 12.078420639038086 _id: “573a13b8f29313caabd4bcbf”
plot: "A graduate student (Nicholson) copes with a recent breakup by conducti…"
genres: Array
runtime: 80
...
title: "Brief Interviews with Hideous Men"
SCORE: 10.180097579956055 _id: “573a13b2f29313caabd3ab9b”
fullplot: "A man runs into a woman at a wedding. They start to flirt and talk and…"
imdb: Object
year: 2005
...
title: "Conversations with Other Women"
SCORE: 7.147367477416992 _id: “573a1398f29313caabce9a19”
plot: "A man's wife leaves him to take up with an artist, so the man responds…"
genres: Array
runtime: 99
...
title: "Men..."
SCORE: 7.054648399353027 _id: “573a1394f29313caabcde7cc”
plot: "Paralized war vet tries to adjust to the world without the use of his …"
genres: Array
runtime: 85
...
title: "The Men"
SCORE: 7.054648399353027 _id: “573a1399f29313caabced53c”
plot: "Bitter about being double-crossed by the women he loved, (and with the…"
genres: Array
runtime: 105
...
title: "Simple Men"
SCORE: 7.054648399353027 _id: “573a139af29313caabcf0f51”
fullplot: "In a world where both Mutants and Humans fear each other, Marie, bette…"
imdb: Object
year: 2000
...
title: "X-Men"
SCORE: 16.18875503540039 _id: “573a1391f29313caabcd93a3”
plot: "Navy divers clear the torpedo tube of a sunken submarine."
genres: Array
runtime: 77
...
title: "Men Without Women"
SCORE: 15.995916366577148 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 15.995916366577148 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 15.642412185668945 _id: “573a13c8f29313caabd77ab6”
plot: "Against the tumultuous backdrop of Iran's 1953 CIA-backed coup d'ètat,…"
genres: Array
runtime: 95
...
title: "Women Without Men"
SCORE: 8.15120792388916 _id: “573a13b8f29313caabd4bcbf”
plot: "A graduate student (Nicholson) copes with a recent breakup by conducti…"
genres: Array
runtime: 80
...
title: "Brief Interviews with Hideous Men"
SCORE: 8.118724822998047 _id: “573a13b2f29313caabd3ab9b”
fullplot: "A man runs into a woman at a wedding. They start to flirt and talk and…"
imdb: Object
year: 2005
...
title: "Conversations with Other Women"
SCORE: 8.048237800598145 _id: “573a13a5f29313caabd138ca”
plot: "This documentary, first shown on the Turner Classic Movies cable chann…"
genres: Array
runtime: 56
...
title: "Without Lying Down: Frances Marion and the Power of Women in Hollywood"
SCORE: 7.620831489562988 _id: “573a13c9f29313caabd7ba99”
plot: "The women of a remote Latin American town are forced to pick up the pi…""
genres: Array
runtime: 87
...
title: "Without Men"
SCORE: 4.35431432723999 _id: “573a1393f29313caabcdcd9d”
plot: "A young Canadian nurse (Betsy) comes to the West Indies to care for Je…"
genres: Array
runtime: 69
...
title: "I Walked with a Zombie"
SCORE: 4.35431432723999 _id: “573a1393f29313caabcdd9c7”
plot: "Political intrigue and psychological drama run parallel. The queen is …"
genres: Array
runtime: 93
...
title: "The Eagle with Two Heads"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Men Without Women' }
4{ title: 'Brief Interviews with Hideous Men' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' }
2{ title: 'Men with Guns' }
3{ title: 'Men with Brooms' }
4{ title: 'Women Without Men' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Men Without Women' }
4{ title: 'Brief Interviews with Hideous Men' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' }
2{ title: 'Men with Guns' }
3{ title: 'Men with Brooms' }
4{ title: 'Women Without Men' }
1{ "title" : "Men with Guns" }
2{ "title" : "Men with Brooms" }
3{ "title" : "Men Without Women" }
4{ "title" : "Brief Interviews with Hideous Men" }
1{ "title" : "Men with Guns" }
2{ "title" : "Men with Brooms" }
3{ "title" : "Getting Even with Dad" }
4{ "title" : "Chicken with Plums" }
1{ "title" : "Men Without Women" }
2{ "title" : "Men with Guns" }
3{ "title" : "Men with Brooms" }
4{ "title" : "Women Without Men" }
1[{title Men with Guns}]
2[{title Men with Brooms}]
3[{title Men Without Women}]
4[{title Brief Interviews with Hideous Men}]
1[{title Men with Guns}]
2[{title Men with Brooms}]
3[{title Getting Even with Dad}]
4[{title Chicken with Plums}]
1[{title Men Without Women}]
2[{title Men with Guns}]
3[{title Men with Brooms}]
4[{title Women Without Men}]
1{"title": "Men with Guns"}
2{"title": "Men with Brooms"}
3{"title": "Men Without Women"}
4{"title": "Brief Interviews with Hideous Men"}
1{"title": "Men with Guns"}
2{"title": "Men with Brooms"}
3{"title": "Getting Even with Dad"}
4{"title": "Chicken with Plums"}
1{"title": "Men Without Women"}
2{"title": "Men with Guns"}
3{"title": "Men with Brooms"}
4{"title": "Women Without Men"}
1Document{{title=Men with Brooms}}
2Document{{title=Men with Guns}}
3Document{{title=Men Without Women}}
4Document{{title=Brief Interviews with Hideous Men}}
1Document{{title=Men with Brooms}}
2Document{{title=Men with Guns}}
3Document{{title=Getting Even with Dad}}
4Document{{title=Chicken with Plums}}
1Document{{title=Men with Guns}}
2Document{{title=Men with Brooms}}
3Document{{title=Men Without Women}}
4Document{{title=Women Without Men}}
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Men Without Women' }
4{ title: 'Brief Interviews with Hideous Men' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' }
2{ title: 'Men with Guns' }
3{ title: 'Men with Brooms' }
4{ title: 'Women Without Men' }
1{'title': 'Men with Guns'}
2{'title': 'Men with Brooms'}
3{'title': 'Men Without Women'}
4{'title': 'Brief Interviews with Hideous Men'}
1{'title': 'Men with Guns'}
2{'title': 'Men with Brooms'}
3{'title': 'Getting Even with Dad'}
4{'title': 'Chicken with Plums'}
1{'title': 'Men Without Women'}
2{'title': 'Men with Brooms'}
3{'title': 'Women Without Men'}
4{'title': 'Men with Guns'}

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "men with",
tokenOrder: "sequential"
}
}
}
]

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

db.movies.aggregate([
{
$search: {
"autocomplete": {
"path": "title",
"query": "men with",
"tokenOrder": "sequential"
}
}
},
{
$limit: 4
},
{
$project: {
"_id": 0,
"title": 1
}
}
])

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"query": "men with",
"path": "title",
"tokenOrder": "sequential"
}
}
$limit
4
$project
{
"_id": 0,
"title": 1,
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteTokenOrderSequentialSimpleExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "men with", SearchAutocompleteTokenOrder.Sequential))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id))
.Limit(4)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.D{{"query", "men with"}, {"path", "title"}, {"tokenOrder", "sequential"}}}}}}
limitStage := bson.D{{"$limit", 4}}
projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"_id", 0}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import static com.mongodb.client.model.Projections.excludeId;
import static com.mongodb.client.model.Projections.fields;
import static com.mongodb.client.model.Projections.include;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteTokenSequential {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete", new Document("query", "men with").append("path", "title").append("tokenOrder", "sequential")));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(4),
project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
}
}
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search",
Document(
"autocomplete",
Document("query", "men with")
.append("path", "title")
.append("tokenOrder", "sequential")
)
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(4),
project(fields(excludeId(), include("title")))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "men with", path: "title", tokenOrder: "sequential"}}},
{$limit: 4},
{$project: {_id: 0,title: 1}}
];
// run pipeline
const result = await coll.aggregate(agg);
// print results
await result.forEach((doc) => console.log(doc));
} finally {
await client.close();
}
}
run().catch(console.dir);

각 쿼리에는

  • $limit 단계를 설정하여 출력을 4개의 결과로 제한합니다.

  • title을 제외한 모든 필드를 제외하는 $project 단계

import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search": {"autocomplete": {"query": "men with", "path": "title", "tokenOrder": "sequential"}}},
{"$limit": 4},
{"$project": {"_id": 0, "title": 1}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 12.644559860229492 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 12.644559860229492 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 7.997925281524658 _id: “573a1391f29313caabcd93a3”
plot: "Navy divers clear the torpedo tube of a sunken submarine."
genres: Array
runtime: 77
...
title: "Men Without Women"
SCORE: 11.758549690246582 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 11.758549690246582 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 7.70704460144043 _id: “573a1399f29313caabcee64e”
plot: "A thief's son cons his father into spending more time with him."
genres: Array
runtime: 109
...
title: "Getting Even with Dad"
SCORE: 7.111915588378906 _id: “573a13cdf29313caabd844f5”
plot: "Since his beloved violin was broken, Nasser Ali Khan, one of the most …"
genres: Array
runtime: 93
...
title: "Chicken with Plums"
SCORE: 7.928277015686035 _id: “573a1391f29313caabcd93a3”
plot: "Navy divers clear the torpedo tube of a sunken submarine."
genres: Array
runtime: 77
...
title: "Men Without Women"
SCORE: 7.928277015686035 _id: “573a139af29313caabcf0b12”
plot: "Humberto Fuentes is a wealthy doctor whose wife has recently died. In …"
genres: Array
runtime: 127
...
title: "Men with Guns"
SCORE: 7.928277015686035 _id: “573a13a4f29313caabd1287f”
plot: "Paul Gross stars as the leader of a recently reunited curling team fro…"
genres: Array
runtime: 102
...
title: "Men with Brooms"
SCORE: 7.381933212280273 _id: “573a13c8f29313caabd77ab6”
plot: "Against the tumultuous backdrop of Iran's 1953 CIA-backed coup d'ètat,…"
genres: Array
runtime: 95
...
title: "Women Without Men"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{ title: 'Men with Guns' },
2{ title: 'Men with Brooms' },
3{ title: 'Men Without Women' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' },
2{ title: 'Men with Guns' },
3{ title: 'Men with Brooms' },
4{ title: 'Women Without Men' }
1{ title: 'Men with Guns' },
2{ title: 'Men with Brooms' },
3{ title: 'Men Without Women' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' },
2{ title: 'Men with Guns' },
3{ title: 'Men with Brooms' },
4{ title: 'Women Without Men' }
1{"title": "Men with Guns"}
2{"title": "Men with Brooms"}
3{"title": "Men Without Women"}
1{ "title" : "Men with Guns" }
2{ "title" : "Men with Brooms" }
3{ "title" : "Getting Even with Dad" }
4{ "title" : "Chicken with Plums" }
1{ "title" : "Men Without Women" }
2{ "title" : "Men with Guns" }
3{ "title" : "Men with Brooms" }
4{ "title" : "Women Without Men" }
1[{title Men with Guns}]
2[{title Men with Brooms}]
3[{title Men Without Women}]
1[{title Men with Guns}]
2[{title Men with Brooms}]
3[{title Getting Even with Dad}]
4[{title Chicken with Plums}]
1[{title Men Without Women}]
2[{title Men with Guns}]
3[{title Men with Brooms}]
4[{title Women Without Men}]
1{"title": "Men with Guns"}
2{"title": "Men with Brooms"}
3{"title": "Men Without Women"}
1{ "title" : "Men with Guns" }
2{ "title" : "Men with Brooms" }
3{ "title" : "Getting Even with Dad" }
4{ "title" : "Chicken with Plums" }
1{"title": "Men Without Women"}
2{"title": "Men with Guns"}
3{"title": "Men with Brooms"}
4{"title": "Women Without Men"}
1Document{{title=Men with Brooms}}
2Document{{title=Men with Guns}}
3Document{{title=Men Without Women}}
1Document{{title=Men with Brooms}}
2Document{{title=Men with Guns}}
3Document{{title=Getting Even with Dad}}
4Document{{title=Chicken with Plums}}
1Document{{title=Men with Guns}}
2Document{{title=Men with Brooms}}
3Document{{title=Men Without Women}}
4Document{{title=Women Without Men}}
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Men Without Women' }
1{ title: 'Men with Guns' }
2{ title: 'Men with Brooms' }
3{ title: 'Getting Even with Dad' }
4{ title: 'Chicken with Plums' }
1{ title: 'Men Without Women' }
2{ title: 'Men with Guns' }
3{ title: 'Men with Brooms' }
4{ title: 'Women Without Men' }
1{'title': 'Men with Guns'}
2{'title': 'Men with Brooms'}
3{'title': 'Men Without Women'}
1{'title': 'Men with Guns'}
2{'title': 'Men with Brooms'}
3{'title': 'Getting Even with Dad'}
4{'title': 'Chicken with Plums'}
1{'title': 'Men Without Women'}
2{'title': 'Men with Guns'}
3{'title': 'Men with Brooms'}
4{'title': 'Women Without Men'}

다음 쿼리는 movies 컬렉션의 title 필드에서 ger 문자를 검색합니다. 이때 title필드에 대해 highlight 옵션을 활성화한 상태에서 문자를 검색합니다.

중요

경로의 자동 완성 인덱싱 버전을 강조 표시하려면 자동 완성 연산자가 쿼리에서 해당 경로를 사용하는 유일한 연산자여야 합니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
autocomplete: {
path: "title",
query: "ger"
},
highlight: {
path: "title"
}
}
}
]

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

db.movies.aggregate([
{
$search: {
"autocomplete": {
"path": "title",
"query": ["ger"]
},
"highlight": {
"path": "title"
}
}
},
{
$limit: 5
},
{
$project: {
"score": { $meta: "searchScore" },
"title": 1,
"_id": 0,
"highlights": { "$meta": "searchHighlights" }
}
}
])

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"autocomplete": {
"path": "title",
"query": ["ger"]
},
"highlight": {
"path": "title"
}
}
$limit
5
$project
{
"score": { $meta: "searchScore" },
"title": 1,
"_id": 0,
"highlights": { "$meta": "searchHighlights" }
}

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Driver;
using MongoDB.Driver.Search;
public class AutocompleteHighlightExample
{
private const string MongoConnectionString = "<connection-string>";
public static void Main(string[] args)
{
// allow automapping of the camelCase database fields to our MovieDocument
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
// connect to your Atlas cluster
var mongoClient = new MongoClient(MongoConnectionString);
var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
// define and run pipeline
var results = moviesCollection.Aggregate()
.Search(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "ger"), new SearchHighlightOptions<MovieDocument>(movie => movie.Title))
.Project<MovieDocument>(Builders<MovieDocument>.Projection
.Include(movie => movie.Title)
.Exclude(movie => movie.Id)
.MetaSearchScore(movie => movie.Score)
.MetaSearchHighlights("highlights"))
.Limit(5)
.ToList();
// print results
foreach (var movie in results)
{
Console.WriteLine(movie.ToJson());
}
}
}
[BsonIgnoreExtraElements]
public class MovieDocument
{
[BsonIgnoreIfDefault]
public ObjectId Id { get; set; }
public string Title { get; set; }
[BsonElement("highlights")]
public List<SearchHighlight> Highlights { get; set; }
public double Score { get; set; }
}

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
func main() {
// connect to your Atlas cluster
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
if err != nil {
panic(err)
}
defer client.Disconnect(context.TODO())
// set namespace
collection := client.Database("sample_mflix").Collection("movies")
// define pipeline stages
searchStage := bson.D{{"$search", bson.D{{"autocomplete", bson.M{"query": "ger","path": "title"}}, {"highlight", bson.D{{"path", "title"}}}}}}
limitStage := bson.D{{"$limit", 5}}
projectStage := bson.D{{"$project", bson.D{{"score", bson.D{{"$meta", "searchScore"}}}, {"title", 1}, {"_id", 0}, {"highlight", bson.D{{"$meta", "searchHighlights"}}}}}}
// run pipeline
cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
if err != nil {
panic(err)
}
// print results
var results []bson.D
if err = cursor.All(context.TODO(), &results); err != nil {
panic(err)
}
for _, result := range results {
fmt.Println(result)
}
}

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

import static com.mongodb.client.model.Aggregates.limit;
import static com.mongodb.client.model.Aggregates.project;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.Arrays;
public class AutocompleteHighlight {
public static void main(String[] args) {
// connect to your Atlas cluster
String uri = "<connection-string>";
try (MongoClient mongoClient = MongoClients.create(uri)) {
// set namespace
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// define pipeline
Document agg = new Document("$search", new Document("autocomplete", new Document("path", "title").append("query", Arrays.asList("ger")))
.append("highlight", new Document("path", "title")));
// run pipeline and print results
collection.aggregate(Arrays.asList(agg,
limit(5),
project(Document.parse("{score: {$meta: 'searchScore'}, _id: 0, title: 1, highlights: {$meta: 'searchHighlights'}}"))))
.forEach(doc -> System.out.println(doc.toJson()));
}
}
}

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

import com.mongodb.client.model.Aggregates.limit
import com.mongodb.client.model.Aggregates.project
import com.mongodb.client.model.Projections.*
import com.mongodb.kotlin.client.coroutine.MongoClient
import kotlinx.coroutines.runBlocking
import org.bson.Document
fun main() {
val uri = "<connection-string>"
val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_mflix")
val collection = database.getCollection<Document>("movies")
runBlocking {
val agg = Document(
"\$search", Document("autocomplete", Document("path", "title")
.append("query", listOf("ger"))
).append("highlight", Document("path", "title"))
)
val resultsFlow = collection.aggregate<Document>(
listOf(
agg,
limit(5),
project(fields(
excludeId(),
include("title"),
computed("score", Document("\$meta", "searchScore")),
computed("highlights", Document("\$meta", "searchHighlights"))
))
)
)
resultsFlow.collect { println(it) }
}
mongoClient.close()
}

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

const { MongoClient } = require("mongodb");
// connect to your Atlas cluster
const uri =
"<connection-string>";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
// set namespace
const database = client.db("sample_mflix");
const coll = database.collection("movies");
// define pipeline
const agg = [
{$search: {autocomplete: {query: "ger", path: "title"}, highlight:{path: "title"}}},
{$limit: 5},
{$project: {score: {$meta: "searchScore"}, _id: 0,title: 1, highlights: {$meta: "searchHighlights"}}}
];
// run pipeline
const result = coll.aggregate(agg);
// print results
result.forEach((doc) => console.dir(JSON.stringify(doc)));
} finally {
await client.close();
}
}
run().catch(console.dir);

쿼리에는 다음이 포함됩니다.

  • $limit 단계를 설정하여 출력을 5개 결과로 제한합니다.

  • $project 단계로 이동합니다:

    • 문서의 점수를 반환합니다.

    • title을 제외한 모든 필드를 제외합니다.

    • 강조 표시 정보가 포함된 highlights이라는 새 필드를 추가합니다.

import pymongo
# connect to your Atlas cluster
client = pymongo.MongoClient('<connection-string>')
# define pipeline
pipeline = [
{"$search":{"autocomplete": {"query": "ger", "path": "title"}, "highlight": {"path": "title"}}},
{"$limit": 5},
{"$project": {"score": {"$meta": "searchScore"},"_id": 0, "title": 1, "highlights": {"$meta": "searchHighlights"}}},
]
# run pipeline
result = client["sample_mflix"]["movies"].aggregate(pipeline)
# print results
for i in result:
print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 6.0822906494140625 _id: “573a1390f29313caabcd50e5”
Gertie the Dinosaur
Matching fields: title
SCORE: 6.0822906494140625 _id: “573a1393f29313caabcddae1”
Germany Year Zero
Matching fields: title
SCORE: 6.0822906494140625 _id: “573a1397f29313caabce6b75”
Germany in Autumn
Matching fields: title
SCORE: 6.0822906494140625 _id: “573a1397f29313caabce77b5”
Germany Pale Mother
Matching fields: title
SCORE: 6.0822906494140625 _id: “573a13d4f29313caabd99fa2”
Gerhard Richter - Painting
Matching fields: title
SCORE: 6.018838405609131 _id: “573a1399f29313caabcedb50”
Geronimo: An American Legend
Matching fields: title
SCORE: 5.825854301452637 _id: “573a139bf29313caabcf36bd”
Geri's Game
Matching fields: title
SCORE: 5.777737617492676 _id: “573a13a5f29313caabd15dae”
How to Live in the German Federal Republic
Matching fields: title
SCORE: 5.738928318023682 _id: “573a13b4f29313caabd41bb7”
The Gerson Miracle
Matching fields: title
SCORE: 5.738928318023682 _id: “573a13d2f29313caabd922de”
The German Doctor
Matching fields: title
SCORE: 4.7550506591796875 _id: “573a139df29313caabcf9ed2”
South Park: Bigger Longer & Uncut
Matching fields: title
SCORE: 4.568849563598633 _id: “573a13a7f29313caabd1addf”
Roger Dodger
Matching fields: title
SCORE: 4.520683288574219 _id: “573a1391f29313caabcd8783”
The Jazz Singer
Matching fields: title
SCORE: 4.520683288574219 _id: “573a1396f29313caabce3974”
Love and Anger
Matching fields: title
SCORE: 4.520683288574219 _id: “573a1396f29313caabce5212”
Save the Tiger
Matching fields: title
SCORE: 4.520683288574219 _id: “573a1397f29313caabce78da”
The Jazz Singer
Matching fields: title
SCORE: 4.520683288574219 _id: “573a1398f29313caabce9be6”
The Toxic Avenger
Matching fields: title
SCORE: 4.520683288574219 _id: “573a139af29313caabcf0f59”
The Wedding Singer
Matching fields: title
SCORE: 4.520683288574219 _id: “573a139af29313caabcf1389”
The Crazy Stranger
Matching fields: title
SCORE: 4.520683288574219 _id: “573a13abf29313caabd24b5a”
Save the Tiger
Matching fields: title
SCORE: 4.371164321899414 _id: “573a139df29313caabcf9ed2”
South Park: Bigger Longer & Uncut
Matching fields: title
SCORE: 4.3067307472229 _id: “573a13bff29313caabd60a4a”
Bigger Stronger Faster*
Matching fields: title
SCORE: 4.26673698425293 _id: “573a1398f29313caabcebb00”
The Toxic Avenger Part II
Matching fields: title
SCORE: 4.26673698425293 _id: “573a1399f29313caabcee12e”
When a Stranger Calls Back
Matching fields: title
SCORE: 4.26673698425293 _id: “573a13cff29313caabd89c2b”
Carol Channing: Larger Than Life
Matching fields: title
SCORE: 4.2623162269592285 _id: “573a1396f29313caabce51c6”
Property Is No Longer a Theft
Matching fields: title
SCORE: 4.2623162269592285 _id: “573a139af29313caabcef539”
Mighty Morphin Power Rangers: The Movie
Matching fields: title
SCORE: 4.2623162269592285 _id: “573a13b1f29313caabd364e3”
Josee, the Tiger and the Fish
Matching fields: title
SCORE: 4.253501892089844 _id: “573a13a5f29313caabd15dae”
How to Live in the German Federal Republic
Matching fields: title
SCORE: 4.24910831451416 _id: “573a13a3f29313caabd0f07f”
Into the Arms of Strangers: Stories of the Kindertransport
Matching fields: title

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{
2 title: 'Gertie the Dinosaur',
3 score: 6.085907459259033,
4 highlights: [{
5 score: 0.9227690100669861,
6 path: 'title',
7 texts: [ { value: 'Gertie the Dinosaur', type: 'hit' } ]
8 }]
9},
10{
11 title: 'Germany Year Zero',
12 score: 6.085907459259033,
13 highlights: [{
14 score: 0.9180012345314026,
15 path: 'title',
16 texts: [ { value: 'Germany Year Zero', type: 'hit' } ]
17 }]
18},
19{
20 title: 'Germany in Autumn',
21 score: 6.085907459259033,
22 highlights: [{
23 score: 0.9180012345314026,
24 path: 'title',
25 texts: [ { value: 'Germany in Autumn', type: 'hit' } ]
26 }]
27},
28{
29 title: 'Germany Pale Mother',
30 score: 6.085907459259033,
31 highlights: [{
32 score: 0.9227690100669861,
33 path: 'title',
34 texts: [ { value: 'Germany Pale Mother', type: 'hit' } ]
35 }]
36},
37{
38 title: 'Gerhard Richter - Painting',
39 score: 6.085907459259033,
40 highlights: [{
41 score: 0.9386774897575378,
42 path: 'title',
43 texts: [ { value: 'Gerhard Richter - Painting', type: 'hit' } ]
44 }]
45}

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1{
2 title: 'South Park: Bigger Longer & Uncut',
3 score: 4.807340621948242,
4 highlights: [{
5 score: 0.6177878975868225,
6 path: 'title',
7 texts: [
8 { value: 'South Park: Bigger Longer', type: 'hit' },
9 { value: ' & Uncut', type: 'text' } ]
10 }]
11},
12{
13 title: 'Roger Dodger',
14 score: 4.6073713302612305,
15 highlights: [{
16 score: 0.905626654624939,
17 path: 'title',
18 texts: [ { value: 'Roger Dodger', type: 'hit' } ]
19 }]
20},
21{
22 title: 'The Jazz Singer',
23 score: 4.577486038208008,
24 highlights: [{
25 score: 0.9131305813789368,
26 path: 'title',
27 texts: [ { value: 'The Jazz Singer', type: 'hit' } ]
28 }]
29},
30{
31 title: 'Love and Anger',
32 score: 4.577486038208008,
33 highlights: [{
34 score: 0.9106559753417969,
35 path: 'title',
36 texts: [ { value: 'Love and Anger', type: 'hit' } ]
37 }]
38},
39{
40 title: 'Save the Tiger',
41 score: 4.577486038208008,
42 highlights: [{
43 score: 0.9106559753417969,
44 path: 'title',
45 texts: [ { value: 'Save the Tiger', type: 'hit' } ]
46 }]
47}

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 title: 'South Park: Bigger Longer & Uncut',
3 score: 4.365298748016357,
4 highlights: [{
5 score: 0.38510727882385254,
6 path: 'title',
7 texts: [ { value: 'South Park: Bigger Longer & Uncut', type: 'hit' } ]
8 }]
9},
10{
11 title: 'Bigger Stronger Faster*',
12 score: 4.300583839416504,
13 highlights: [{
14 score: 0.5282801985740662,
15 path: 'title',
16 texts: [
17 { value: 'Bigger Stronger Faster', type: 'hit' },
18 { value: '*', type: 'text' }
19 ]
20 }]
21},
22{
23 title: 'The Toxic Avenger Part II',
24 score: 4.2650651931762695,
25 highlights: [{
26 score: 0.5984020829200745,
27 path: 'title',
28 texts: [ { value: 'The Toxic Avenger Part II', type: 'hit' } ]
29 }]
30},
31{
32 title: 'When a Stranger Calls Back',
33 score: 4.2650651931762695,
34 highlights: [{
35 score: 0.6008684039115906,
36 path: 'title',
37 texts: [ { value: 'When a Stranger Calls Back', type: 'hit' } ]
38 }]
39},
40{
41 title: 'Carol Channing: Larger Than Life',
42 score: 4.2650651931762695,
43 highlights: [{
44 score: 0.6154072880744934,
45 path: 'title',
46 texts: [ { value: 'Carol Channing: Larger Than Life', type: 'hit' } ]
47 }]
48}

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 title: 'Gertie the Dinosaur',
3 score: 6.085907459259033,
4 highlights: [{
5 score: 0.9227690100669861,
6 path: 'title',
7 texts: [ { value: 'Gertie the Dinosaur', type: 'hit' } ]
8 }]
9},
10{
11 title: 'Germany Year Zero',
12 score: 6.085907459259033,
13 highlights: [{
14 score: 0.9180012345314026,
15 path: 'title',
16 texts: [ { value: 'Germany Year Zero', type: 'hit' } ]
17 }]
18},
19{
20 title: 'Germany in Autumn',
21 score: 6.085907459259033,
22 highlights: [{
23 score: 0.9180012345314026,
24 path: 'title',
25 texts: [ { value: 'Germany in Autumn', type: 'hit' } ]
26 }]
27},
28{
29 title: 'Germany Pale Mother',
30 score: 6.085907459259033,
31 highlights: [{
32 score: 0.9227690100669861,
33 path: 'title',
34 texts: [ { value: 'Germany Pale Mother', type: 'hit' } ]
35 }]
36},
37{
38 title: 'Gerhard Richter - Painting',
39 score: 6.085907459259033,
40 highlights: [{
41 score: 0.9386774897575378,
42 path: 'title',
43 texts: [ { value: 'Gerhard Richter - Painting', type: 'hit' } ]
44 }]
45}

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1{
2 title: 'South Park: Bigger Longer & Uncut',
3 score: 4.807340621948242,
4 highlights: [{
5 score: 0.6177878975868225,
6 path: 'title',
7 texts: [
8 { value: 'South Park: Bigger Longer', type: 'hit' },
9 { value: ' & Uncut', type: 'text' } ]
10 }]
11},
12{
13 title: 'Roger Dodger',
14 score: 4.6073713302612305,
15 highlights: [{
16 score: 0.905626654624939,
17 path: 'title',
18 texts: [ { value: 'Roger Dodger', type: 'hit' } ]
19 }]
20},
21{
22 title: 'The Jazz Singer',
23 score: 4.577486038208008,
24 highlights: [{
25 score: 0.9131305813789368,
26 path: 'title',
27 texts: [ { value: 'The Jazz Singer', type: 'hit' } ]
28 }]
29},
30{
31 title: 'Love and Anger',
32 score: 4.577486038208008,
33 highlights: [{
34 score: 0.9106559753417969,
35 path: 'title',
36 texts: [ { value: 'Love and Anger', type: 'hit' } ]
37 }]
38},
39{
40 title: 'Save the Tiger',
41 score: 4.577486038208008,
42 highlights: [{
43 score: 0.9106559753417969,
44 path: 'title',
45 texts: [ { value: 'Save the Tiger', type: 'hit' } ]
46 }]
47}

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 title: 'South Park: Bigger Longer & Uncut',
3 score: 4.365298748016357,
4 highlights: [{
5 score: 0.38510727882385254,
6 path: 'title',
7 texts: [ { value: 'South Park: Bigger Longer & Uncut', type: 'hit' } ]
8 }]
9},
10{
11 title: 'Bigger Stronger Faster*',
12 score: 4.300583839416504,
13 highlights: [{
14 score: 0.5282801985740662,
15 path: 'title',
16 texts: [
17 { value: 'Bigger Stronger Faster', type: 'hit' },
18 { value: '*', type: 'text' }
19 ]
20 }]
21},
22{
23 title: 'The Toxic Avenger Part II',
24 score: 4.2650651931762695,
25 highlights: [{
26 score: 0.5984020829200745,
27 path: 'title',
28 texts: [ { value: 'The Toxic Avenger Part II', type: 'hit' } ]
29 }]
30},
31{
32 title: 'When a Stranger Calls Back',
33 score: 4.2650651931762695,
34 highlights: [{
35 score: 0.6008684039115906,
36 path: 'title',
37 texts: [ { value: 'When a Stranger Calls Back', type: 'hit' } ]
38 }]
39},
40{
41 title: 'Carol Channing: Larger Than Life',
42 score: 4.2650651931762695,
43 highlights: [{
44 score: 0.6154072880744934,
45 path: 'title',
46 texts: [ { value: 'Carol Channing: Larger Than Life', type: 'hit' } ]
47 }]
48}

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1{ "title" : "Gertie the Dinosaur", "highlights" : [{ "path" : "title", "score" : 0.92276901006698608, "texts" : [{ "type" : "Hit", "value" : "Gertie the Dinosaur" }] }], "score" : 6.0822906494140625 }
2{ "title" : "Germany Year Zero", "highlights" : [{ "path" : "title", "score" : 0.91800123453140259, "texts" : [{ "type" : "Hit", "value" : "Germany Year Zero" }] }], "score" : 6.0822906494140625 }
3{ "title" : "Germany in Autumn", "highlights" : [{ "path" : "title", "score" : 0.91800123453140259, "texts" : [{ "type" : "Hit", "value" : "Germany in Autumn" }] }], "score" : 6.0822906494140625 }
4{ "title" : "Germany Pale Mother", "highlights" : [{ "path" : "title", "score" : 0.92276901006698608, "texts" : [{ "type" : "Hit", "value" : "Germany Pale Mother" }] }], "score" : 6.0822906494140625 }
5{ "title" : "Gerhard Richter - Painting", "highlights" : [{ "path" : "title", "score" : 0.93867748975753784, "texts" : [{ "type" : "Hit", "value" : "Gerhard Richter - Painting" }] }], "score" : 6.0822906494140625 }

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1{ "title" : "South Park: Bigger Longer & Uncut", "highlights" : [{ "path" : "title", "score" : 0.61778789758682251, "texts" : [{ "type" : "Hit", "value" : "South Park: Bigger Longer" }, { "type" : "Text", "value" : " & Uncut" }] }], "score" : 4.7550506591796875 }
2{ "title" : "Roger Dodger", "highlights" : [{ "path" : "title", "score" : 0.90562665462493896, "texts" : [{ "type" : "Hit", "value" : "Roger Dodger" }] }], "score" : 4.5688495635986328 }
3{ "title" : "The Jazz Singer", "highlights" : [{ "path" : "title", "score" : 0.91313058137893677, "texts" : [{ "type" : "Hit", "value" : "The Jazz Singer" }] }], "score" : 4.5206832885742188 }
4{ "title" : "Love and Anger", "highlights" : [{ "path" : "title", "score" : 0.91065597534179688, "texts" : [{ "type" : "Hit", "value" : "Love and Anger" }] }], "score" : 4.5206832885742188 }
5{ "title" : "Save the Tiger", "highlights" : [{ "path" : "title", "score" : 0.91065597534179688, "texts" : [{ "type" : "Hit", "value" : "Save the Tiger" }] }], "score" : 4.5206832885742188 }

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1{ "title" : "South Park: Bigger Longer & Uncut", "highlights" : [{ "path" : "title", "score" : 0.38510727882385254, "texts" : [{ "type" : "Hit", "value" : "South Park: Bigger Longer & Uncut" }] }], "score" : 4.3711643218994141 }
2{ "title" : "Bigger Stronger Faster*", "highlights" : [{ "path" : "title", "score" : 0.52828019857406616, "texts" : [{ "type" : "Hit", "value" : "Bigger Stronger Faster" }, { "type" : "Text", "value" : "*" }] }], "score" : 4.3067307472229004 }
3{ "title" : "The Toxic Avenger Part II", "highlights" : [{ "path" : "title", "score" : 0.59840208292007446, "texts" : [{ "type" : "Hit", "value" : "The Toxic Avenger Part II" }] }], "score" : 4.2667369842529297 }
4{ "title" : "When a Stranger Calls Back", "highlights" : [{ "path" : "title", "score" : 0.60086840391159058, "texts" : [{ "type" : "Hit", "value" : "When a Stranger Calls Back" }] }], "score" : 4.2667369842529297 }
5{ "title" : "Carol Channing: Larger Than Life", "highlights" : [{ "path" : "title", "score" : 0.61540728807449341, "texts" : [{ "type" : "Hit", "value" : "Carol Channing: Larger Than Life" }] }], "score" : 4.2667369842529297 }

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1[
2 {title Gertie the Dinosaur}
3 {score 6.085907459259033}
4 {highlight [[
5 {score 0.9227690100669861}
6 {path title}
7 {texts [[{value Gertie the Dinosaur} {type hit}]]}]]}]
8[
9 {title Germany Year Zero}
10 {score 6.085907459259033}
11 {highlight [[
12 {score 0.9180012345314026}
13 {path title}
14 {texts [[{value Germany Year Zero} {type hit}]]}]]}]
15[
16 {title Germany in Autumn}
17 {score 6.085907459259033}
18 {highlight [[
19 {score 0.9180012345314026}
20 {path title}
21 {texts [[{value Germany in Autumn} {type hit}]]}]]}]
22[
23 {title Germany Pale Mother}
24 {score 6.085907459259033}
25 {highlight [[
26 {score 0.9227690100669861}
27 {path title}
28 {texts [[{value Germany Pale Mother} {type hit}]]}]]}]
29[
30 {title Gerhard Richter - Painting}
31 {score 6.085907459259033}
32 {highlight [[
33 {score 0.9386774897575378}
34 {path title}
35 {texts [[{value Gerhard Richter - Painting} {type hit}]]}]]}]

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1[
2 {title South Park: Bigger Longer & Uncut}
3 {score 4.807340621948242}
4 {highlight [[
5 {score 0.6177878975868225}
6 {path title}
7 {texts [[{value South Park: Bigger Longer} {type hit}] [{value & Uncut} {type text}]]}]]}]
8[
9 {title Roger Dodger}
10 {score 4.6073713302612305}
11 {highlight [[
12 {score 0.905626654624939}
13 {path title}
14 {texts [[{value Roger Dodger} {type hit}]]}]]}]
15[
16 {title The Jazz Singer}
17 {score 4.577486038208008}
18 {highlight [[
19 {score 0.9131305813789368}
20 {path title}
21 {texts [[{value The Jazz Singer} {type hit}]]}]]}]
22[
23 {title Love and Anger}
24 {score 4.577486038208008}
25 {highlight [[
26 {score 0.9106559753417969}
27 {path title}
28 {texts [[{value Love and Anger} {type hit}]]}]]}]
29[
30 {title Save the Tiger}
31 {score 4.577486038208008}
32 {highlight [[
33 {score 0.9106559753417969}
34 {path title}
35 {texts [[{value Save the Tiger} {type hit}]]}]]}]

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1[
2 {title South Park: Bigger Longer & Uncut}
3 {score 4.365298748016357}
4 {highlight [[
5 {score 0.38510727882385254}
6 {path title}
7 {texts [[{value South Park: Bigger Longer & Uncut} {type hit}]]}]]}]
8[
9 {title Bigger Stronger Faster*} {
10 score 4.300583839416504}
11 {highlight [[
12 {score 0.5282801985740662}
13 {path title}
14 {texts [[{value Bigger Stronger Faster} {type hit}] [{value *} {type text}]]}]]}]
15[
16 {title The Toxic Avenger Part II}
17 {score 4.2650651931762695}
18 {highlight [[
19 {score 0.5984020829200745}
20 {path title}
21 {texts [[{value The Toxic Avenger Part II} {type hit}]]}]]}]
22[
23 {title When a Stranger Calls Back}
24 {score 4.2650651931762695}
25 {highlight [[
26 {score 0.6008684039115906}
27 {path title}
28 {texts [[{value When a Stranger Calls Back} {type hit}]]}]]}]
29[
30 {title Carol Channing: Larger Than Life}
31 {score 4.2650651931762695}
32 {highlight [[
33 {score 0.6154072880744934}
34 {path title}
35 {texts [[{value Carol Channing: Larger Than Life} {type hit}]]}]]}]

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 "title": "Gertie the Dinosaur",
3 "score": 6.085907459259033,
4 "highlights": [{
5 "score": 0.9227690100669861,
6 "path": "title",
7 "texts": [{"value": "Gertie the Dinosaur", "type": "hit"}]}]}
8{
9 "title": "Germany Year Zero",
10 "score": 6.085907459259033,
11 "highlights": [{
12 "score": 0.9180012345314026,
13 "path": "title",
14 "texts": [{"value": "Germany Year Zero", "type": "hit"}]}]}
15{
16 "title": "Germany in Autumn",
17 "score": 6.085907459259033,
18 "highlights": [{
19 "score": 0.9180012345314026,
20 "path": "title",
21 "texts": [{"value": "Germany in Autumn", "type": "hit"}]}]}
22{
23 "title": "Germany Pale Mother",
24 "score": 6.085907459259033,
25 "highlights": [{
26 "score": 0.9227690100669861,
27 "path": "title",
28 "texts": [{"value": "Germany Pale Mother", "type": "hit"}]}]}
29{
30 "title": "Gerhard Richter - Painting",
31 "score": 6.085907459259033,
32 "highlights": [{
33 "score": 0.9386774897575378,
34 "path": "title",
35 "texts": [{"value": "Gerhard Richter - Painting", "type": "hit"}]}]}

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1{
2 "title": "South Park: Bigger Longer & Uncut",
3 "score": 4.807340621948242,
4 "highlights": [{
5 "score": 0.6177878975868225,
6 "path": "title",
7 "texts": [{"value": "South Park: Bigger Longer", "type": "hit"}, {"value": " & Uncut", "type": "text"}]}]}
8{
9 "title": "Roger Dodger",
10 "score": 4.6073713302612305,
11 "highlights": [{
12 "score": 0.905626654624939,
13 "path": "title",
14 "texts": [{"value": "Roger Dodger", "type": "hit"}]}]}
15{
16 "title": "The Jazz Singer",
17 "score": 4.577486038208008,
18 "highlights": [{
19 "score": 0.9131305813789368,
20 "path": "title",
21 "texts": [{"value": "The Jazz Singer", "type": "hit"}]}]}
22{
23 "title": "Love and Anger",
24 "score": 4.577486038208008,
25 "highlights": [{
26 "score": 0.9106559753417969,
27 "path": "title",
28 "texts": [{"value": "Love and Anger", "type": "hit"}]}]}
29{
30 "title": "Save the Tiger",
31 "score": 4.577486038208008,
32 "highlights": [{
33 "score": 0.9106559753417969,
34 "path": "title",
35 "texts": [{"value": "Save the Tiger", "type": "hit"}]}]}

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 "title": "South Park: Bigger Longer & Uncut",
3 "score": 4.365298748016357,
4 "highlights": [{
5 "score": 0.38510727882385254,
6 "path": "title",
7 "texts": [{"value": "South Park: Bigger Longer & Uncut", "type": "hit"}]}]}
8{
9 "title": "Bigger Stronger Faster*",
10 "score": 4.300583839416504,
11 "highlights": [{
12 "score": 0.5282801985740662,
13 "path": "title",
14 "texts": [{"value": "Bigger Stronger Faster", "type": "hit"}, {"value": "*", "type": "text"}]}]}
15{
16 "title": "The Toxic Avenger Part II",
17 "score": 4.2650651931762695,
18 "highlights": [{
19 "score": 0.5984020829200745,
20 "path": "title",
21 "texts": [{"value": "The Toxic Avenger Part II", "type": "hit"}]}]}
22{
23 "title": "When a Stranger Calls Back",
24 "score": 4.2650651931762695,
25 "highlights": [{
26 "score": 0.6008684039115906,
27 "path": "title",
28 "texts": [{"value": "When a Stranger Calls Back", "type": "hit"}]}]}
29{
30 "title": "Carol Channing: Larger Than Life",
31 "score": 4.2650651931762695,
32 "highlights": [{
33 "score": 0.6154072880744934,
34 "path": "title",
35 "texts": [{"value": "Carol Channing: Larger Than Life", "type": "hit"}]}]}

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1Document{{title=Germany in Autumn, score=6.160550117492676, highlights=[Document{{score=0.9180012345314026, path=title, texts=[Document{{value=Germany in Autumn, type=hit}}]}}]}}
2Document{{title=Gertie the Dinosaur, score=6.160550117492676, highlights=[Document{{score=0.9227690100669861, path=title, texts=[Document{{value=Gertie the Dinosaur, type=hit}}]}}]}}
3Document{{title=Germany Pale Mother, score=6.160550117492676, highlights=[Document{{score=0.9227690100669861, path=title, texts=[Document{{value=Germany Pale Mother, type=hit}}]}}]}}
4Document{{title=Geronimo: An American Legend, score=6.096138954162598, highlights=[Document{{score=0.9430088996887207, path=title, texts=[Document{{value=Geronimo: An American, type=hit}}, Document{{value= Legend, type=text}}]}}]}}
5Document{{title=Geri's Game, score=5.900832176208496, highlights=[Document{{score=1.1180211305618286, path=title, texts=[Document{{value=Geri's Game, type=hit}}]}}]}}

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1Document{{title=South Park: Bigger Longer & Uncut, score=4.770905017852783, highlights=[Document{{score=0.6177878975868225, path=title, texts=[Document{{value=South Park: Bigger Longer, type=hit}}, Document{{value= & Uncut, type=text}}]}}]}}
2Document{{title=Roger Dodger, score=4.584150791168213, highlights=[Document{{score=0.905626654624939, path=title, texts=[Document{{value=Roger Dodger, type=hit}}]}}]}}
3Document{{title=The Crazy Stranger, score=4.535715103149414, highlights=[Document{{score=0.9203977584838867, path=title, texts=[Document{{value=The Crazy Stranger, type=hit}}]}}]}}
4Document{{title=The Ring Finger, score=4.535715103149414, highlights=[Document{{score=0.9131305813789368, path=title, texts=[Document{{value=The Ring Finger, type=hit}}]}}]}}
5Document{{title=Shoot the Messenger, score=4.535715103149414, highlights=[Document{{score=0.9227690100669861, path=title, texts=[Document{{value=Shoot the Messenger, type=hit}}]}}]}}

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1Document{{title=South Park: Bigger Longer & Uncut, score=4.395573139190674, highlights=[Document{{score=0.38510727882385254, path=title, texts=[Document{{value=South Park: Bigger Longer & Uncut, type=hit}}]}}]}}
2Document{{title=Bigger Stronger Faster*, score=4.33078145980835, highlights=[Document{{score=0.5282801985740662, path=title, texts=[Document{{value=Bigger Stronger Faster, type=hit}}, Document{{value=*, type=text}}]}}]}}
3Document{{title=The Toxic Avenger Part II, score=4.2905426025390625, highlights=[Document{{score=0.5984020829200745, path=title, texts=[Document{{value=The Toxic Avenger Part II, type=hit}}]}}]}}
4Document{{title=Carol Channing: Larger Than Life, score=4.2905426025390625, highlights=[Document{{score=0.6154072880744934, path=title, texts=[Document{{value=Carol Channing: Larger Than Life, type=hit}}]}}]}}
5Document{{title=When a Stranger Calls Back, score=4.2905426025390625, highlights=[Document{{score=0.6008684039115906, path=title, texts=[Document{{value=When a Stranger Calls Back, type=hit}}]}}]}}

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1'{
2 "title":"Gertie the Dinosaur",
3 "score":6.0822906494140625,
4 "highlights":[{
5 "score":0.9227690100669861,
6 "path":"title",
7 "texts":[{"value":"Gertie the Dinosaur","type":"hit"}]}]}'
8'{
9 "title":"Germany Year Zero",
10 "score":6.0822906494140625,
11 "highlights":[{
12 "score":0.9180012345314026,
13 "path":"title",
14 "texts":[{"value":"Germany Year Zero","type":"hit"}]}]}'
15'{
16 "title":"Germany in Autumn",
17 "score":6.0822906494140625,
18 "highlights":[{
19 "score":0.9180012345314026,
20 "path":"title",
21 "texts":[{"value":"Germany in Autumn","type":"hit"}]}]}'
22'{
23 "title":"Germany Pale Mother",
24 "score":6.0822906494140625,
25 "highlights":[{
26 "score":0.9227690100669861,
27 "path":"title",
28 "texts":[{"value":"Germany Pale Mother","type":"hit"}]}]}'
29'{
30 "title":"Gerhard Richter - Painting",
31 "score":6.0822906494140625,
32 "highlights":[{
33 "score":0.9386774897575378,
34 "path":"title",
35 "texts":[{"value":"Gerhard Richter - Painting","type":"hit"}]}]}'

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1'{
2 "title":"South Park: Bigger Longer & Uncut",
3 "score":4.7550506591796875,
4 "highlights":[{
5 "score":0.6177878975868225,
6 "path":"title",
7 "texts":[{"value":"South Park: Bigger Longer","type":"hit"},{"value":" & Uncut","type":"text"}]}]}'
8'{
9 "title":"Roger Dodger",
10 "score":4.568849563598633,
11 "highlights":[{
12 "score":0.905626654624939,
13 "path":"title",
14 "texts":[{"value":"Roger Dodger","type":"hit"}]}]}'
15'{
16 "title":"The Jazz Singer",
17 "score":4.520683288574219,
18 "highlights":[{
19 "score":0.9131305813789368,
20 "path":"title",
21 "texts":[{"value":"The Jazz Singer","type":"hit"}]}]}'
22'{
23 "title":"Love and Anger",
24 "score":4.520683288574219,
25 "highlights":[{
26 "score":0.9106559753417969,
27 "path":"title",
28 "texts":[{"value":"Love and Anger","type":"hit"}]}]}'
29'{
30 "title":"Save the Tiger",
31 "score":4.520683288574219,
32 "highlights":[{
33 "score":0.9106559753417969,
34 "path":"title",
35 "texts":[{"value":"Save the Tiger","type":"hit"}]}]}'

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1'{
2 "title":"South Park: Bigger Longer & Uncut",
3 "score":4.371164321899414,
4 "highlights":[{
5 "score":0.38510727882385254,
6 "path":"title",
7 "texts":[{"value":"South Park: Bigger Longer & Uncut","type":"hit"}]}]}'
8'{
9 "title":"Bigger Stronger Faster*",
10 "score":4.3067307472229,
11 "highlights":[{
12 "score":0.5282801985740662,
13 "path":"title",
14 "texts":[{"value":"Bigger Stronger Faster","type":"hit"},{"value":"*","type":"text"}]}]}'
15'{
16 "title":"The Toxic Avenger Part II",
17 "score":4.26673698425293,
18 "highlights":[{
19 "score":0.5984020829200745,
20 "path":"title",
21 "texts":[{"value":"The Toxic Avenger Part II","type":"hit"}]}]}'
22'{
23 "title":"When a Stranger Calls Back",
24 "score":4.26673698425293,
25 "highlights":[{
26 "score":0.6008684039115906,
27 "path":"title",
28 "texts":[{"value":"When a Stranger Calls Back","type":"hit"}]}]}'
29'{
30 "title":"Carol Channing: Larger Than Life",
31 "score":4.26673698425293,
32 "highlights":[{
33 "score":0.6154072880744934,
34 "path":"title",
35 "texts":[{"value":"Carol Channing: Larger Than Life","type":"hit"}]}]}'

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 'highlights': [{
3 'path': 'title',
4 'score': 0.9227690100669861,
5 'texts': [{'type': 'hit', 'value': 'Gertie the Dinosaur'}]}],
6 'score': 6.085907459259033,
7 'title': 'Gertie the Dinosaur'}
8{
9 'highlights': [{
10 'path': 'title',
11 'score': 0.9180012345314026,
12 'texts': [{'type': 'hit', 'value': 'Germany Year Zero'}]}],
13 'score': 6.085907459259033,
14 'title': 'Germany Year Zero'}
15{
16 'highlights': [{
17 'path': 'title',
18 'score': 0.9180012345314026,
19 'texts': [{'type': 'hit', 'value': 'Germany in Autumn'}]}],
20 'score': 6.085907459259033,
21 'title': 'Germany in Autumn'}
22{
23 'highlights': [{
24 'path': 'title',
25 'score': 0.9227690100669861,
26 'texts': [{'type': 'hit', 'value': 'Germany Pale Mother'}]}],
27 'score': 6.085907459259033,
28 'title': 'Germany Pale Mother'}
29{
30 'highlights': [{
31 'path': 'title',
32 'score': 0.9386774897575378,
33 'texts': [{'type': 'hit', 'value': 'Gerhard Richter - Painting'}]}],
34 'score': 6.085907459259033,
35 'title': 'Gerhard Richter - Painting'}

모든 제목에서 단어의 왼쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을 쿼리 텀에 좀 더 폭넓게 매칭시킵니다.

1{
2 'highlights': [{
3 'path': 'title',
4 'score': 0.6177878975868225,
5 'texts': [{'type': 'hit', 'value': 'South Park: Bigger Longer'}, {'type': 'text', 'value': ' & Uncut'}]}],
6 'score': 4.807340621948242,
7 'title': 'South Park: Bigger Longer & Uncut'}
8{
9 'highlights': [{
10 'path': 'title',
11 'score': 0.905626654624939,
12 'texts': [{'type': 'hit', 'value': 'Roger Dodger'}]}],
13 'score': 4.6073713302612305,
14 'title': 'Roger Dodger'}
15{
16 'highlights': [{
17 'path': 'title',
18 'score': 0.9131305813789368,
19 'texts': [{'type': 'hit', 'value': 'The Jazz Singer'}]}],
20 'score': 4.577486038208008,
21 'title': 'The Jazz Singer'}
22{
23 'highlights': [{
24 'path': 'title',
25 'score': 0.9106559753417969,
26 'texts': [{'type': 'hit', 'value': 'Love and Anger'}]}],
27 'score': 4.577486038208008,
28 'title': 'Love and Anger'}
29{
30 'highlights': [{
31 'path': 'title',
32 'score': 0.9106559753417969,
33 'texts': [{'type': 'hit', 'value': 'Save the Tiger'}]}],
34 'score': 4.577486038208008,
35 'title': 'Save the Tiger'}

모든 제목에서 단어의 오른쪽에 ger 문자가 표시되므로 Atlas Search가 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit를 검색어에 좀 더 폭넓게 매칭시킵니다.

1{
2 'highlights': [{
3 'path': 'title',
4 'score': 0.38510727882385254,
5 'texts': [{'type': 'hit', 'value': 'South Park: Bigger Longer & Uncut'}]}],
6 'score': 4.365298748016357,
7 'title': 'South Park: Bigger Longer & Uncut'}
8{
9 'highlights': [{
10 'path': 'title',
11 'score': 0.5282801985740662,
12 'texts':[{'type': 'hit', 'value': 'Bigger Stronger Faster'}, {'type': 'text', 'value': '*'}]}],
13 'score': 4.300583839416504,
14 'title': 'Bigger Stronger Faster*'}
15{
16 'highlights': [{
17 'path': 'title',
18 'score': 0.5984020829200745,
19 'texts': [{'type': 'hit', 'value': 'The Toxic Avenger Part II'}]}],
20 'score': 4.2650651931762695,
21 'title': 'The Toxic Avenger Part II'}
22{
23 'highlights': [{
24 'path': 'title',
25 'score': 0.6008684039115906,
26 'texts': [{'type': 'hit', 'value': 'When a Stranger Calls Back'}]}],
27 'score': 4.2650651931762695,
28 'title': 'When a Stranger Calls Back'}
29{
30 'highlights': [{
31 'path': 'title',
32 'score': 0.6154072880744934,
33 'texts': [{'type': 'hit', 'value': 'Carol Channing: Larger Than Life'}]}],
34 'score': 4.2650651931762695,
35 'title': 'Carol Channing: Larger Than Life'}

Atlas Search는 ger 문자가 제목의 다른 위치에 나타나기 때문에 이러한 결과를 반환합니다. Atlas Search는 강조 표시된 경로가 강조 표시된 쿼리의 자동 완성 연산자에서만 참조되는 경우 강조 표시된 hit을(를) 검색어에 좀 더 폭넓게 매칭시킵니다.

다음 쿼리는 복합 연산자를 사용하여 movies 컬렉션의 titleplot 필드에서 문자열 inter로 시작하는 단어를 검색합니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
$search: {
compound: {
should: [
{
autocomplete: {
query: "inter",
path: "title"
}
},
{
text: {
query: "inter",
path: "plot"
}
}
],
minimumShouldMatch: 1
}
}
}
]

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1db.movies.aggregate([
2 {
3 $search: {
4 "compound": {
5 "should": [
6 {
7 "autocomplete": {
8 "query": "inter",
9 "path": "title",
10 },
11 },
12 {
13 "text": {
14 "query": "inter",
15 "path": "plot",
16 }
17 }
18 ],
19 "minimumShouldMatch": 1
20 },
21 },
22 },
23 {
24 $limit: 10,
25 },
26 {
27 $project:
28 {
29 "_id": 0,
30 "title": 1,
31 "plot": 1
32 },
33 },
34])

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

movies colection의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다. Add Stage를 클릭하여 단계를 추가합니다.

파이프라인 단계
쿼리
$search
{
"compound": {
"should": [{
"autocomplete": {
"query": "inter",
"path": "title"
}
},
{
"text": {
"path": "inter",
"query": "plot",
}
}],
"minimumShouldMatch": 1
}
}
$limit
10
$project
{
"_id": 0,
"title": 1,
"plot": 1
}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1using MongoDB.Bson;
2using MongoDB.Bson.Serialization.Attributes;
3using MongoDB.Bson.Serialization.Conventions;
4using MongoDB.Driver;
5using MongoDB.Driver.Search;
6
7public class AutocompleteCompoundExample
8{
9 private const string MongoConnectionString = "<connection-string>";
10
11 public static void Main(string[] args)
12 {
13 // allow automapping of the camelCase database fields to our MovieDocument
14 var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
15 ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
16
17 // connect to your Atlas cluster
18 var mongoClient = new MongoClient(MongoConnectionString);
19 var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
20 var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
21
22 // define and run pipeline
23 var results = moviesCollection.Aggregate()
24 .Search(Builders<MovieDocument>.Search.Compound()
25 .Should(Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "inter"))
26 .Should(Builders<MovieDocument>.Search.Text(movie => movie.Plot, "inter")))
27 .Project<MovieDocument>(Builders<MovieDocument>.Projection
28 .Include(movie => movie.Plot)
29 .Include(movie => movie.Title)
30 .Exclude(movie => movie.Id))
31 .Limit(10)
32 .ToList();
33
34 // print results
35 foreach (var movie in results)
36 {
37 Console.WriteLine(movie.ToJson());
38 }
39 }
40}
41
42[BsonIgnoreExtraElements]
43public class MovieDocument
44{
45 [BsonIgnoreIfDefault]
46 public ObjectId Id { get; set; }
47 public string Plot { get; set; }
48 public string Title { get; set; }
49}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1package main
2
3import (
4 "context"
5 "fmt"
6
7 "go.mongodb.org/mongo-driver/bson"
8 "go.mongodb.org/mongo-driver/mongo"
9 "go.mongodb.org/mongo-driver/mongo/options"
10)
11
12func main() {
13 // connect to your Atlas cluster
14 client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
15 if err != nil {
16 panic(err)
17 }
18 defer client.Disconnect(context.TODO())
19
20 // set namespace
21 collection := client.Database("sample_mflix").Collection("movies")
22
23 // define pipeline stages
24 searchStage := bson.D{
25 {"$search", bson.D{
26 {"compound", bson.D{
27 {"should", bson.A{
28 bson.D{
29 {"autocomplete", bson.D{{"query", "inter"}, {"path", "title"}}},
30 },
31 bson.D{
32 {"autocomplete", bson.D{{"query", "inter"}, {"path", "plot"}}},
33 },
34 }},
35 {"minimumShouldMatch", 1},
36 }},
37 }},
38 }
39 limitStage := bson.D{{"$limit", 10}}
40 projectStage := bson.D{{"$project", bson.D{{"title", 1}, {"plot", 1}, {"_id", 0}}}}
41 // run pipeline
42 cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchStage, limitStage, projectStage})
43 if err != nil {
44 panic(err)
45 }
46
47 // print results
48 var results []bson.D
49 if err = cursor.All(context.TODO(), &results); err != nil {
50 panic(err)
51 }
52 for _, result := range results {
53 fmt.Println(result)
54 }
55}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1import static com.mongodb.client.model.Aggregates.limit;
2import static com.mongodb.client.model.Aggregates.project;
3import static com.mongodb.client.model.Projections.excludeId;
4import static com.mongodb.client.model.Projections.fields;
5import static com.mongodb.client.model.Projections.include;
6import com.mongodb.client.MongoClient;
7import com.mongodb.client.MongoClients;
8import com.mongodb.client.MongoCollection;
9import com.mongodb.client.MongoDatabase;
10import org.bson.Document;
11import java.util.Arrays;
12
13public class AutocompleteQuery {
14
15 public static void main(String[] args) {
16 // connect to your Atlas cluster
17 String uri = "<connection-string>";
18
19 try (MongoClient mongoClient = MongoClients.create(uri)) {
20 // set namespace
21 MongoDatabase database = mongoClient.getDatabase("sample_mflix");
22 MongoCollection<Document> collection = database.getCollection("movies");
23
24 // define pipeline
25 Document agg = new Document(new Document("should", Arrays.asList(new Document("autocomplete",
26 new Document("path", "title")
27 .append("query", "inter")),
28 new Document("text",
29 new Document("path", "plot")
30 .append("query", "inter"))))
31 .append("minimumShouldMatch", 1L));
32
33 // run pipeline and print results
34 collection.aggregate(Arrays.asList(
35 eq("$search", eq("compound", agg)),
36 limit(10),
37 project(fields(excludeId(), include("title"))))).forEach(doc -> System.out.println(doc.toJson()));
38 }
39 }
40}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1import com.mongodb.client.model.Aggregates.limit
2import com.mongodb.client.model.Aggregates.project
3import com.mongodb.client.model.Filters.eq
4import com.mongodb.client.model.Projections.*
5import com.mongodb.kotlin.client.coroutine.MongoClient
6import kotlinx.coroutines.runBlocking
7import org.bson.Document
8
9fun main() {
10 val uri = "<connection-string>"
11 val mongoClient = MongoClient.create(uri)
12 val database = mongoClient.getDatabase("sample_mflix")
13 val collection = database.getCollection<Document>("movies")
14
15 runBlocking {
16 val agg = Document(
17 Document(
18 "should", listOf(
19 Document(
20 "autocomplete",
21 Document("path", "title")
22 .append("query", "inter")
23 ),
24 Document(
25 "text",
26 Document("path", "plot")
27 .append("query", "inter")
28 )
29 )
30 ).append("minimumShouldMatch", 1L)
31 )
32
33 val resultsFlow = collection.aggregate<Document>(
34 listOf(
35 eq("\$search", eq("compound", agg)),
36 limit(10),
37 project(fields(excludeId(), include("title", "plot")))
38 )
39 )
40 resultsFlow.collect { println(it) }
41 }
42 mongoClient.close()
43}

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1const { MongoClient } = require("mongodb");
2
3// connect to your Atlas cluster
4const uri =
5 "<connection-string>";
6
7const client = new MongoClient(uri);
8
9async function run() {
10 try {
11 await client.connect();
12
13 // set namespace
14 const database = client.db("sample_mflix");
15 const coll = database.collection("movies");
16
17 // define pipeline
18 const agg = [
19 {
20 '$search': {
21 'compound': {
22 'should': [
23 {
24 'autocomplete': {
25 'query': 'inter',
26 'path': 'title'
27 }
28 },
29 {
30 'autocomplete': {
31 'query': 'inter',
32 'path': 'plot'
33 }
34 }
35 ],
36 'minimumShouldMatch': 1
37 }
38 }
39 },
40 {
41 '$limit': 10
42 },
43 {
44 '$project': {
45 '_id': 0,
46 'title': 1,
47 'plot': 1
48 }
49 }
50 ];
51 // run pipelines
52 const result = await coll.aggregate(agg);
53
54 // print results
55 await result.forEach((doc) => console.log(doc));
56 } finally {
57 await client.close();
58 }
59}
60run().catch(console.dir);

쿼리에는 다음이 포함됩니다.

  • $limit 출력을 결과 10개로 제한하는 [$limit] 단계

  • titleplot를 제외한 모든 필드를 제외하려면 $project 단계를 수행합니다.

1import pymongo
2
3# connect to your Atlas cluster
4client = pymongo.MongoClient('<connection-string>')
5
6# define pipeline
7pipeline = [
8 {
9 '$search': {
10 'compound': {
11 'should': [
12 {
13 'autocomplete': {
14 'query': 'inter',
15 'path': 'title'
16 }
17 }, {
18 'autocomplete': {
19 'query': 'inter',
20 'path': 'plot'
21 }
22 }
23 ],
24 'minimumShouldMatch': 1
25 }
26 }
27 },
28 {
29 '$limit': 10
30 },
31 {
32 '$project': {
33 '_id': 0, 'title': 1, 'plot': 1
34 }
35 }
36]
37# run pipeline
38result = client["sample_mflix"]["movies"].aggregate(pipeline)
39
40# print results
41for i in result:
42 print(i)

참고

고객의 결과는 다를 수 있음

Atlas Search는 자동 완성 유형에 대한 인덱스 정의에 구성된 토큰화 전략에 따라 다른 결과를 반환합니다. 자세히 알아보려면 자동 완성을 위한 필드 인덱싱 방법을 참조하세요.

SCORE: 5.796849727630615 _id: “573a13dbf29313caabdaf9a0”
fullplot: "In order to avoid an X rating, 40 minutes of gay S&M footage was rumor…"
imdb: Object
year: 2013
...
title: "Interior. Leather Bar."
SCORE: 5.736375331878662 1 _id: “573a13a8f29313caabd1d060”
plot: "Almost forty years after the John F. Kennedy assassination, an ex-Mari…"
genres: Array
runtime: 88
...
title: "Interview with the Assassin"
SCORE: 5.677149295806885 _id: “573a13b8f29313caabd4bcbf”
plot: "A graduate student (Nicholson) copes with a recent breakup by conducti…"
genres: Array
runtime: 80
...
title: "Brief Interviews with Hideous Men"
SCORE: 5.619133949279785 _id: “573a139af29313caabcf0753”
fullplot: "Austin Powers is a 60's spy who is cryonically frozen and released in …"
imdb: Object
year: 1997
...
title: "Austin Powers: International Man of Mystery"
SCORE: 5.619133949279785 _id: “573a139df29313caabcfb827”
plot: "A confused young man (Marsden) takes a journey on a road that doesn't …"
genres: Array
runtime: 116
...
title: "Interstate 60: Episodes of the Road"
SCORE: 5.562292575836182 __id: “573a1399f29313caabcee754”
fullplot: "It hasn't even been a year since a plantation owner named Louis lost h…"
imdb: Object
year: 1984
...
title: "Interview with the Vampire: The Vampire Chronicles"
SCORE: 5.55244779586792 _id: “573a1394f29313caabcdfd1e”
plot: "The film chronicles Australian-born opera star Marjorie Lawrence's suc…"
genres: Array
runtime: 106
...
title: "Interrupted Melody"
SCORE: 5.451991081237793 _id: “573a13e9f29313caabdcbd58”
plot: "The story of programming prodigy and information activist Aaron Swartz…"
genres: Array
runtime: 105
...
title: "The Internet's Own Boy: The Story of Aaron Swartz"
SCORE: 5.389190673828125 _id: “573a13bef29313caabd5d0ac”
plot: "Locked up and isolated, constantly exposed and threatened to be killed…"
genres: Array
runtime: 89
...
title: "Richness of Internal Space"
SCORE: 4.929009437561035 _id: “573a1397f29313caabce6ca7”
plot: "Three sisters find their lives spinning out of control in the wake of …"
genres: Array
runtime: 93
...
title: "Interiors"
SCORE: 5.94391393661499 _id: “573a13b1f29313caabd35dc7”
plot: "After her son is hospitalized, a doctor cheats on her husband with a s…"
genres: Array
runtime: 84
...
title: "Kissed by Winter"
SCORE: 5.94391393661499 _id: “573a13b4f29313caabd3f3fe”
plot: "The American oil company KIC Corporation is building an ice road to ex…"
genres: Array
runtime: 101
...
title: "The Last Winter"
SCORE: 5.94391393661499 _id: “573a13c0f29313caabd62f21”
plot: "A couple engage in discussions with people on the street, politicians …"
genres: Array
runtime: 85
...
title: "Suddenly, Last Winter"
SCORE: 5.94391393661499 _id: “573a13d5f29313caabd9a45b”
plot: "WINTER is a dangerous, sexy, poignant and at times darkly funny story …"
genres: Array
runtime: 132
...
title: "After Fall, Winter"
SCORE: 5.881905555725098 _id: “573a1396f29313caabce366e”
plot: "1183 AD: King Henry II's three sons all want to inherit the throne, bu…"
genres: Array
runtime: 134
...
title: "The Lion in Winter"
SCORE: 5.881905555725098 _id: “573a1396f29313caabce5271”
plot: "Rita, a middle aged New York City homemaker, finds herself in an emoti…"
genres: Array
runtime: 93
...
title: "Summer Wishes, Winter Dreams"
SCORE: 5.881905555725098 _id: “573a1399f29313caabcecfef”
plot: "Felicie and Charles have a serious if whirlwind holiday romance. Due t…"
genres: Array
runtime: 114
...
title: "A Tale of Winter"
SCORE: 5.881905555725098 _id: “573a139af29313caabcf1762”
plot: "A mysterious creature is killing a farmer's livestock."
genres: Array
runtime: 92
...
title: "In the Winter Dark"
SCORE: 5.821177005767822 _id: “573a13a0f29313caabd02f47”
plot: "Sean is a little duck with a big problem. Due to a mishap with a jet a…"
genres: Array
runtime: 28
...
title: "The First Snow of Winter"
SCORE: 5.821177005767822 _id: “573a13b3f29313caabd3eb6f”
plot: "A renowned artist must uncover a young dancer's secrets in order to tr…"
genres: Array
runtime: 129
...
title: "A Year Ago in Winter"
SCORE: 5.540487289428711 _id: “573a139af29313caabcf0753”
fullplot: "Austin Powers is a 60's spy who is cryonically frozen and released in …"
imdb: Object
year: 1997
...
title: "Austin Powers: International Man of Mystery"
SCORE: 5.540487289428711 _id: “573a13aef29313caabd2ca07”
plot: "On an isolated lake, an old monk lives on a small floating temple. The…"
genres: Array
runtime: 103
...
title: "Spring, Summer, Fall, Winter... and Spring"
SCORE: 5.495308876037598 _id: “573a1396f29313caabce5271”
plot: "Rita, a middle aged New York City homemaker, finds herself in an emoti…"
genres: Array
runtime: 93
...
title: "Summer Wishes, Winter Dreams"
SCORE: 5.495308876037598 _id: “573a139af29313caabcf1762”
plot: "A mysterious creature is killing a farmer's livestock."
genres: Array
runtime: 92
...
title: "In the Winter Dark"
SCORE: 5.495308876037598 _id: “573a13bef29313caabd5d0ac”
plot: "Locked up and isolated, constantly exposed and threatened to be killed…"
genres: Array
runtime: 89
...
title: "Richness of Internal Space"
SCORE: 5.4885406494140625 _id: “573a13b8f29313caabd4bcbf”
plot: "A graduate student (Nicholson) copes with a recent breakup by conducti…"
genres: Array
runtime: 80
...
title: "Brief Interviews with Hideous Men"
SCORE: 5.4885406494140625 _id: “573a13d2f29313caabd91d33”
fullplot: "For Steve Rogers, awakening after decades of suspended animation invol…"
imdb Object
year: 2014
...
title: "Captain America: The Winter Soldier"
SCORE: 5.481788635253906 _id: “573a139ff29313caabd01cc6”
plot: "On a cold winter day a mysterious stranger shows up at the Witting Far…"
genres: Array
runtime: 95
...
title: "Sarah, Plain and Tall: Winter's End"
SCORE: 5.46163272857666 _id: “573a13e9f29313caabdcbd58”
plot: "The story of programming prodigy and information activist Aaron Swartz…"
genres: Array
runtime: 105
...
title: "The Internet's Own Boy: The Story of Aaron Swartz"
SCORE: 5.420651435852051 _id: “573a1398f29313caabcebac5”
plot: "Set during World War 2. After Nazi Germany invaded Poland in September…"
genres: Array
runtime: 195
...
title: "The Winter War"

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1{
2 plot: 'Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.',
3 title: 'Interior. Leather Bar.'
4},
5{
6 plot: 'Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.',
7 title: 'Interview with the Assassin'
8},
9{
10 plot: 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
11 title: 'Brief Interviews with Hideous Men'
12},
13{
14 plot: 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
15 title: 'Austin Powers\:\ International Man of Mystery'
16},
17{
18 plot: 'A confused young man (Marsden) takes a journey on a road that doesn\'t exist on any map.',
19 title: 'Interstate 60\:\ Episodes of the Road'
20},
21{
22 plot: 'A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.',
23 title: 'Interview with the Vampire\:\ The Vampire Chronicles'
24},
25{
26 plot: 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
27 title: 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
28},
29{
30 plot: 'The film chronicles Australian-born opera star Marjorie Lawrence\'s success, her battle with polio, and her eventual career comeback.',
31 title: 'Interrupted Melody'
32}
33{
34 plot: 'Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.',
35 title: 'Richness of Internal Space'
36}
37{
38 plot: 'Three sisters find their lives spinning out of control in the wake of their parents\' sudden, unexpected divorce.',
39 title: 'Interiors'
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 plot: 'After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.',
3 title: 'Kissed by Winter'
4},
5{
6 plot: 'The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...',
7 title: 'The Last Winter'
8},
9{
10 plot: 'A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.',
11 title: 'Suddenly, Last Winter'
12},
13{
14 plot: 'WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...',
15 title: 'After Fall, Winter'
16},
17{
18 plot: 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
19 title: 'Summer Wishes, Winter Dreams'
20},
21{
22 plot: '1183 AD\:\ King Henry II\'s three sons all want to inherit the throne, but he won\'t commit to a choice. They and his wife variously plot to force him.',
23 title: 'The Lion in Winter'
24},
25{
26 plot: 'Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...',
27 title: 'A Tale of Winter'
28},
29{
30 plot: 'A mysterious creature is killing a farmer\'s livestock.',
31 title: 'In the Winter Dark'
32},
33{
34 plot: 'Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...',
35 title: 'The First Snow of Winter'
36},
37{
38 plot: 'A renowned artist must uncover a young dancer\'s secrets in order to truly capture her likeness for a commissioned work.',
39 title: 'A Year Ago in Winter'
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 plot: 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
3 title: 'Austin Powers\:\ International Man of Mystery'
4},
5{
6 plot: 'On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.',
7 title: 'Spring, Summer, Fall, Winter... and Spring'
8},
9{
10 plot: 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
11 title: 'Summer Wishes, Winter Dreams'
12},
13{
14 plot: 'A mysterious creature is killing a farmer\'s livestock.',
15 title: 'In the Winter Dark'
16},
17{
18 plot: 'Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.',
19 title: 'Richness of Internal Space'
20},
21{
22 plot: 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
23 title: 'Brief Interviews with Hideous Men'
24},
25{
26 plot: 'As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.',
27 title: 'Captain America\:\ The Winter Soldier'
28},
29{
30 plot: 'On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...',
31 title: 'Sarah, Plain and Tall\:\ Winter\'s End'
32},
33{
34 plot: 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
35 title: 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
36},
37{
38 plot: 'Out of work actor Joe volunteers to help try and save his sister\'s local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...',
39 title: 'A Midwinter\'s Tale'
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1{
2 plot: 'Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.',
3 title: 'Interior. Leather Bar.'
4},
5{
6 plot: 'Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.',
7 title: 'Interview with the Assassin'
8},
9{
10 plot: 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
11 title: 'Brief Interviews with Hideous Men'
12},
13{
14 plot: 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
15 title: 'Austin Powers\:\ International Man of Mystery'
16},
17{
18 plot: 'A confused young man (Marsden) takes a journey on a road that doesn\'t exist on any map.',
19 title: 'Interstate 60\:\ Episodes of the Road'
20},
21{
22 plot: 'A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.',
23 title: 'Interview with the Vampire\:\ The Vampire Chronicles'
24},
25{
26 plot: 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
27 title: 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
28},
29{
30 plot: 'The film chronicles Australian-born opera star Marjorie Lawrence\'s success, her battle with polio, and her eventual career comeback.',
31 title: 'Interrupted Melody'
32}
33{
34 plot: 'Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.',
35 title: 'Richness of Internal Space'
36}
37{
38 plot: 'Three sisters find their lives spinning out of control in the wake of their parents\' sudden, unexpected divorce.',
39 title: 'Interiors'
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 plot: 'After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.',
3 title: 'Kissed by Winter'
4},
5{
6 plot: 'The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...',
7 title: 'The Last Winter'
8},
9{
10 plot: 'A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.',
11 title: 'Suddenly, Last Winter'
12},
13{
14 plot: 'WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...',
15 title: 'After Fall, Winter'
16},
17{
18 plot: 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
19 title: 'Summer Wishes, Winter Dreams'
20},
21{
22 plot: '1183 AD\:\ King Henry II\'s three sons all want to inherit the throne, but he won\'t commit to a choice. They and his wife variously plot to force him.',
23 title: 'The Lion in Winter'
24},
25{
26 plot: 'Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...',
27 title: 'A Tale of Winter'
28},
29{
30 plot: 'A mysterious creature is killing a farmer\'s livestock.',
31 title: 'In the Winter Dark'
32},
33{
34 plot: 'Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...',
35 title: 'The First Snow of Winter'
36},
37{
38 plot: 'A renowned artist must uncover a young dancer\'s secrets in order to truly capture her likeness for a commissioned work.',
39 title: 'A Year Ago in Winter'
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 plot: 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
3 title: 'Austin Powers\:\ International Man of Mystery'
4},
5{
6 plot: 'On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.',
7 title: 'Spring, Summer, Fall, Winter... and Spring'
8},
9{
10 plot: 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
11 title: 'Summer Wishes, Winter Dreams'
12},
13{
14 plot: 'A mysterious creature is killing a farmer\'s livestock.',
15 title: 'In the Winter Dark'
16},
17{
18 plot: 'Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.',
19 title: 'Richness of Internal Space'
20},
21{
22 plot: 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
23 title: 'Brief Interviews with Hideous Men'
24},
25{
26 plot: 'As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.',
27 title: 'Captain America\:\ The Winter Soldier'
28},
29{
30 plot: 'On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...',
31 title: 'Sarah, Plain and Tall\:\ Winter\'s End'
32},
33{
34 plot: 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
35 title: 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
36},
37{
38 plot: 'Out of work actor Joe volunteers to help try and save his sister\'s local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...',
39 title: 'A Midwinter\'s Tale'
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1{
2 "plot" : 'Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.',
3 "title" : 'Interior. Leather Bar.'
4}
5{
6 "plot" : 'Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.',
7 "title" : 'Interview with the Assassin'
8}
9{
10 "plot" : 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
11 "title" : 'Brief Interviews with Hideous Men'
12}
13{
14 "plot" : 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
15 "title" : 'Austin Powers\:\ International Man of Mystery'
16}
17{
18 "plot" : 'A confused young man (Marsden) takes a journey on a road that doesn\'t exist on any map.',
19 "title" : 'Interstate 60\:\ Episodes of the Road'
20}
21{
22 "plot" : 'A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.',
23 "title" : 'Interview with the Vampire\:\ The Vampire Chronicles'
24}
25{
26 "plot" : 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
27 "title" : 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
28}
29{
30 "plot" : 'The film chronicles Australian-born opera star Marjorie Lawrence\'s success, her battle with polio, and her eventual career comeback.',
31 "title" : 'Interrupted Melody'
32}
33{
34 "plot" : "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
35 "title" : "Richness of Internal Space"
36}
37{
38 "plot" : "Three sisters find their lives spinning out of control in the wake of their parents' sudden, unexpected divorce.",
39 "title" : "Interiors"
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 "plot" : 'After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.',
3 "title" : 'Kissed by Winter'
4}
5{
6 "plot" : 'The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...',
7 "title" : 'The Last Winter'
8}
9{
10 "plot" : 'A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.',
11 "title" : 'Suddenly, Last Winter'
12}
13{
14 "plot" : 'WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...',
15 "title" : 'After Fall, Winter'
16}
17{
18 "plot" : 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
19 "title" : 'Summer Wishes, Winter Dreams'
20}
21{
22 "plot" : '1183 AD\:\ King Henry II\'s three sons all want to inherit the throne, but he won\'t commit to a choice. They and his wife variously plot to force him.',
23 "title" : 'The Lion in Winter'
24}
25{
26 "plot" : 'Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...',
27 "title" : 'A Tale of Winter'
28}
29{
30 "plot" : 'A mysterious creature is killing a farmer\'s livestock.',
31 "title" : 'In the Winter Dark'
32}
33{
34 "plot" : 'Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...',
35 "title" : 'The First Snow of Winter'
36}
37{
38 "plot" : 'A renowned artist must uncover a young dancer\'s secrets in order to truly capture her likeness for a commissioned work.',
39 "title" : 'A Year Ago in Winter'
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 "plot" : 'A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.',
3 "title" : 'Austin Powers\:\ International Man of Mystery'
4}
5{
6 "plot" : 'On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.',
7 "title" : 'Spring, Summer, Fall, Winter... and Spring'
8}
9{
10 "plot" : 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
11 "title" : 'Summer Wishes, Winter Dreams'
12}
13{
14 "plot" : 'A mysterious creature is killing a farmer\'s livestock.',
15 "title" : 'In the Winter Dark'
16}
17{
18 "plot" : 'Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.',
19 "title" : 'Richness of Internal Space'
20}
21{
22 "plot" : 'A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.',
23 "title" : 'Brief Interviews with Hideous Men'
24}
25{
26 "plot" : 'As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.',
27 "title" : 'Captain America\:\ The Winter Soldier'
28}
29{
30 "plot" : 'On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...',
31 "title" : 'Sarah, Plain and Tall\:\ Winter\'s End'
32}
33{
34 "plot" : 'The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.',
35 "title" : 'The Internet\'s Own Boy\:\ The Story of Aaron Swartz'
36}
37{
38 "plot" : 'Out of work actor Joe volunteers to help try and save his sister\'s local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...',
39 "title" : 'A Midwinter\'s Tale'
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1[
2 {plot Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.}
3 {title Interior. Leather Bar.}
4]
5[
6 {plot Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.}
7 {title Interview with the Assassin}
8]
9[
10 {plot A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.}
11 {title Brief Interviews with Hideous Men}
12]
13[
14 {plot A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.}
15 {title Austin Powers: International Man of Mystery}
16]
17[
18 {plot A confused young man (Marsden) takes a journey on a road that doesn't exist on any map.}
19 {title Interstate 60: Episodes of the Road}
20]
21[
22 {plot A vampire tells his epic life story: love, betrayal, loneliness, and hunger.}
23 {title Interview with the Vampire: The Vampire Chronicles}
24]
25[
26 {plot The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.}
27 {title The Internet's Own Boy: The Story of Aaron Swartz}
28]
29[
30 {plot The film chronicles Australian-born opera star Marjorie Lawrence's success, her battle with polio, and her eventual career comeback.}
31 {title Interrupted Melody}
32]
33[
34 {plot Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.}
35 {title Richness of Internal Space}
36]
37[
38 {plot Three sisters find their lives spinning out of control in the wake of their parents' sudden, unexpected divorce.}
39 {title Interiors}
40]

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1[
2 {plot After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.}
3 {title Kissed by Winter}
4]
5[
6 {plot The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...}
7 {title The Last Winter}
8]
9[
10 {plot A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.}
11 {title Suddenly, Last Winter}
12]
13[
14 {plot WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...}
15 {title After Fall, Winter}
16]
17[
18 {plot Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...}
19 {title Summer Wishes, Winter Dreams}
20]
21[
22 {plot 1183 AD: King Henry II's three sons all want to inherit the throne, but he won't commit to a choice. They and his wife variously plot to force him.}
23 {title The Lion in Winter}
24]
25[
26 {plot Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...}
27 {title A Tale of Winter}
28]
29[
30 {plot A mysterious creature is killing a farmer's livestock.}
31 {title In the Winter Dark}
32]
33[
34 {plot Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...}
35 {title The First Snow of Winter}
36]
37[
38 {plot A renowned artist must uncover a young dancer's secrets in order to truly capture her likeness for a commissioned work.}
39 {title A Year Ago in Winter}
40]

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1[
2 {plot A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.}
3 {title Austin Powers: International Man of Mystery}
4]
5[
6 {plot On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.}
7 {title Spring, Summer, Fall, Winter... and Spring}
8]
9[
10 {plot Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...}
11 {title Summer Wishes, Winter Dreams}
12]
13[
14 {plot A mysterious creature is killing a farmer's livestock.}
15 {title In the Winter Dark}
16]
17[
18 {plot Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.}
19 {title Richness of Internal Space}
20]
21[
22 {plot A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.}
23 {title Brief Interviews with Hideous Men}
24]
25[
26 {plot As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history: an assassin known as the Winter Soldier.}
27 {title Captain America: The Winter Soldier}
28]
29[
30 {plot On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...}
31 {title Sarah, Plain and Tall: Winter's End}
32]
33[
34 {plot The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.}
35 {title The Internet's Own Boy: The Story of Aaron Swartz}
36]
37[
38 {plot Out of work actor Joe volunteers to help try and save his sister's local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...}
39 {title A Midwinter's Tale}
40]

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1{
2 "plot" : "Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.",
3 "title" : "Interior. Leather Bar."
4}
5{
6 "plot" : "Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.",
7 "title" : "Interview with the Assassin"
8}
9{
10 "plot" : "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
11 "title" : "Brief Interviews with Hideous Men"
12}
13{
14 "plot" : "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
15 "title" : "Austin Powers\:\ International Man of Mystery"
16}
17{
18 "plot" : "A confused young man (Marsden) takes a journey on a road that doesn't exist on any map.",
19 "title" : "Interstate 60\:\ Episodes of the Road"
20}
21{
22 "plot" : "A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.",
23 "title" : "Interview with the Vampire\:\ The Vampire Chronicles"
24}
25{
26 "plot" : "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
27 "title" : "The Internet's Own Boy\:\ The Story of Aaron Swartz"
28}
29{
30 "plot" : "The film chronicles Australian-born opera star Marjorie Lawrence's success, her battle with polio, and her eventual career comeback.",
31 "title" : "Interrupted Melody"
32}
33{
34 "plot" : "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
35 "title" : "Richness of Internal Space"
36}
37{
38 "plot" : "Three sisters find their lives spinning out of control in the wake of their parents' sudden, unexpected divorce.",
39 "title" : "Interiors"
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 "plot" : 'After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.',
3 "title" : 'Kissed by Winter'
4}
5{
6 "plot" : 'The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...',
7 "title" : 'The Last Winter'
8}
9{
10 "plot" : 'A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.',
11 "title" : 'Suddenly, Last Winter'
12}
13{
14 "plot" : 'WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...',
15 "title" : 'After Fall, Winter'
16}
17{
18 "plot" : 'Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...',
19 "title" : 'Summer Wishes, Winter Dreams'
20}
21{
22 "plot" : '1183 AD\:\ King Henry II\'s three sons all want to inherit the throne, but he won\'t commit to a choice. They and his wife variously plot to force him.',
23 "title" : 'The Lion in Winter'
24}
25{
26 "plot" : 'Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...',
27 "title" : 'A Tale of Winter'
28}
29{
30 "plot" : 'A mysterious creature is killing a farmer\'s livestock.',
31 "title" : 'In the Winter Dark'
32}
33{
34 "plot" : 'Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...',
35 "title" : 'The First Snow of Winter'
36}
37{
38 "plot" : 'A renowned artist must uncover a young dancer\'s secrets in order to truly capture her likeness for a commissioned work.',
39 "title" : 'A Year Ago in Winter'
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 "plot": "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
3 "title": "Austin Powers\:\ International Man of Mystery"
4}
5{
6 "plot": "On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.",
7 "title": "Spring, Summer, Fall, Winter... and Spring"
8}
9{
10 "plot": "Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...",
11 "title": "Summer Wishes, Winter Dreams"
12}
13{
14 "plot": "A mysterious creature is killing a farmer's livestock.",
15 "title": "In the Winter Dark"
16}
17{
18 "plot": "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
19 "title": "Richness of Internal Space"
20}
21{
22 "plot": "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
23 "title": "Brief Interviews with Hideous Men"
24}
25{
26 "plot": "As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.",
27 "title": "Captain America\:\ The Winter Soldier"
28}
29{
30 "plot": "On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...",
31 "title": "Sarah, Plain and Tall\:\ Winter's End"
32}
33{
34 "plot": "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
35 "title": "The Internet's Own Boy\:\ The Story of Aaron Swartz"
36}
37{
38 "plot": "Out of work actor Joe volunteers to help try and save his sister's local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...",
39 "title": "A Midwinter's Tale"
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1Document{{plot=Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim., title=Interview with the Assassin}}
2Document{{plot=A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men., title=Brief Interviews with Hideous Men}}
3Document{{plot=A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place., title=Austin Powers: International Man of Mystery}}
4Document{{plot=A confused young man (Marsden) takes a journey on a road that doesn't exist on any map., title=Interstate 60: Episodes of the Road}}
5Document{{plot=A vampire tells his epic life story: love, betrayal, loneliness, and hunger., title=Interview with the Vampire: The Vampire Chronicles}}
6Document{{plot=The film chronicles Australian-born opera star Marjorie Lawrence's success, her battle with polio, and her eventual career comeback., title=Interrupted Melody}}
7Document{{plot=The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26., title=The Internet's Own Boy: The Story of Aaron Swartz}}
8Document{{plot=Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man., title=Richness of Internal Space}}
9Document{{plot=Vincent Eastman has to choose between his wife of 16 years, Sally, and his new love, Olivia. Frequent flashbacks explain the background to the marriage and the affair., title=Intersection}}
10Document{{plot=After falling out with his editor, a fading political journalist is forced to interview America's most popular soap actress., title=Interview}}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1Document{{plot=A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy., title=Suddenly, Last Winter}}
2Document{{plot=After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy., title=Kissed by Winter}}
3Document{{plot=WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ..., title=After Fall, Winter}}
4Document{{plot=Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ..., title=A Tale of Winter}}
5Document{{plot=A mysterious creature is killing a farmer's livestock., title=In the Winter Dark}}
6Document{{plot=Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ..., title=Summer Wishes, Winter Dreams}}
7Document{{plot=1183 AD: King Henry II's three sons all want to inherit the throne, but he won't commit to a choice. They and his wife variously plot to force him., title=The Lion in Winter}}
8Document{{plot=As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history: an assassin known as the Winter Soldier., title=Captain America: The Winter Soldier}}
9Document{{plot=Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ..., title=The First Snow of Winter}}
10Document{{plot=A renowned artist must uncover a young dancer's secrets in order to truly capture her likeness for a commissioned work., title=A Year Ago in Winter}}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1Document{{plot=On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by., title=Spring, Summer, Fall, Winter... and Spring}}
2Document{{plot=A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place., title=Austin Powers: International Man of Mystery}}
3Document{{plot=Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ..., title=Summer Wishes, Winter Dreams}}
4Document{{plot=A mysterious creature is killing a farmer's livestock., title=In the Winter Dark}}
5Document{{plot=Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man., title=Richness of Internal Space}}
6Document{{plot=A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men., title=Brief Interviews with Hideous Men}}
7Document{{plot=As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history: an assassin known as the Winter Soldier., title=Captain America: The Winter Soldier}}
8Document{{plot=On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ..., title=Sarah, Plain and Tall: Winter's End}}
9Document{{plot=The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26., title=The Internet's Own Boy: The Story of Aaron Swartz}}
10Document{{plot=Set during World War 2. After Nazi Germany invaded Poland in September 1939, Russia attacked Finland in November 1939. Finnish reservists leave their homes and go to war. The film focuses ..., title=The Winter War}}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1{
2 "plot": "Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.",
3 "title": "Interior. Leather Bar."
4}
5{
6 "plot": "Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.",
7 "title": "Interview with the Assassin"
8}
9{
10 "plot": "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
11 "title": "Brief Interviews with Hideous Men"
12}
13{
14 "plot": "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
15 "title": "Austin Powers\:\ International Man of Mystery"
16}
17{
18 "plot": "A confused young man (Marsden) takes a journey on a road that doesn't exist on any map.",
19 "title": "Interstate 60\:\ Episodes of the Road"
20}
21{
22 "plot": "A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.",
23 "title": "Interview with the Vampire\:\ The Vampire Chronicles"
24}
25{
26 "plot": "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
27 "title": "The Internet's Own Boy\:\ The Story of Aaron Swartz"
28}
29{
30 "plot": "The film chronicles Australian-born opera star Marjorie Lawrence's success, her battle with polio, and her eventual career comeback.",
31 "title": "Interrupted Melody"
32}
33{
34 "plot": "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
35 "title": "Richness of Internal Space"
36}
37{
38 "plot": "Three sisters find their lives spinning out of control in the wake of their parents' sudden, unexpected divorce.",
39 "title": "Interiors"
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 "plot": "After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.",
3 "title": "Kissed by Winter"
4}
5{
6 "plot": "The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...",
7 "title": "The Last Winter"
8}
9{
10 "plot": "A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.",
11 "title": "Suddenly, Last Winter"
12}
13{
14 "plot": "WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...",
15 "title": "After Fall, Winter"
16}
17{
18 "plot": "Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...",
19 "title": "Summer Wishes, Winter Dreams"
20}
21{
22 "plot": "1183 AD\:\ King Henry II's three sons all want to inherit the throne, but he won't commit to a choice. They and his wife variously plot to force him.",
23 "title": "The Lion in Winter"
24}
25{
26 "plot": "Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...",
27 "title": "A Tale of Winter"
28}
29{
30 "plot": "A mysterious creature is killing a farmer's livestock.",
31 "title": "In the Winter Dark"
32}
33{
34 "plot": "Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...",
35 "title": "The First Snow of Winter"
36}
37{
38 "plot": "A renowned artist must uncover a young dancer's secrets in order to truly capture her likeness for a commissioned work.",
39 "title": "A Year Ago in Winter"
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 "plot": "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
3 "title": "Austin Powers\:\ International Man of Mystery"
4}
5{
6 "plot": "On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.",
7 "title": "Spring, Summer, Fall, Winter... and Spring"
8}
9{
10 "plot": "Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...",
11 "title": "Summer Wishes, Winter Dreams"
12}
13{
14 "plot": "A mysterious creature is killing a farmer's livestock.",
15 "title": "In the Winter Dark"
16}
17{
18 "plot": "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
19 "title": "Richness of Internal Space"
20}
21{
22 "plot": "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
23 "title": "Brief Interviews with Hideous Men"
24}
25{
26 "plot": "As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.",
27 "title": "Captain America\:\ The Winter Soldier"
28}
29{
30 "plot": "On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...",
31 "title": "Sarah, Plain and Tall\:\ Winter's End"
32}
33{
34 "plot": "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
35 "title": "The Internet's Own Boy\:\ The Story of Aaron Swartz"
36}
37{
38 "plot": "Out of work actor Joe volunteers to help try and save his sister's local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...",
39 "title": "A Midwinter's Tale"
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

1{
2 "plot": "Filmmakers James Franco and Travis Mathews re-imagine the lost 40 minutes from \"Cruising\" as a starting point to a broader exploration of sexual and creative freedom.",
3 "title": "Interior. Leather Bar."
4}
5{
6 "plot": "Almost forty years after the John F. Kennedy assassination, an ex-Marine named Walter Ohlinger has come forward with a startling claim.",
7 "title": "Interview with the Assassin"
8}
9{
10 "plot": "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
11 "title": "Brief Interviews with Hideous Men"
12}
13{
14 "plot": "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
15 "title": "Austin Powers\:\ International Man of Mystery"
16}
17{
18 "plot": "A confused young man (Marsden) takes a journey on a road that doesn't exist on any map.",
19 "title": "Interstate 60\:\ Episodes of the Road"
20}
21{
22 "plot": "A vampire tells his epic life story\:\ love, betrayal, loneliness, and hunger.",
23 "title": "Interview with the Vampire\:\ The Vampire Chronicles"
24}
25{
26 "plot": "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
27 "title": "The Internet's Own Boy\:\ The Story of Aaron Swartz"
28}
29{
30 "plot": "The film chronicles Australian-born opera star Marjorie Lawrence's success, her battle with polio, and her eventual career comeback.",
31 "title": "Interrupted Melody"
32}
33{
34 "plot": "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
35 "title": "Richness of Internal Space"
36}
37{
38 "plot": "Three sisters find their lives spinning out of control in the wake of their parents' sudden, unexpected divorce.",
39 "title": "Interiors"
40}

이 결과에서는 title 또는 plot 필드의 단어 시작 부분에 inter 문자가 나타납니다. Atlas Search는 단어 왼쪽에서 시작하는 title, plot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 시작하는 결과를 반환합니다.

1{
2 "plot": "After her son is hospitalized, a doctor cheats on her husband with a snow plow driver who is a suspect in her investigation of the recent death of a young Arab boy.",
3 "title": "Kissed by Winter"
4}
5{
6 "plot": "The American oil company KIC Corporation is building an ice road to explore the remote Northern Arctic National Wildlife Refuge seeking energy independence. Independent environmentalists ...",
7 "title": "The Last Winter"
8}
9{
10 "plot": "A couple engage in discussions with people on the street, politicians and religious leaders about the discrimination against gays and lesbians in Italy.",
11 "title": "Suddenly, Last Winter"
12}
13{
14 "plot": "WINTER is a dangerous, sexy, poignant and at times darkly funny story about two people who desperately want intimacy but have fashioned lives of reclusivity and emotional fracture which ...",
15 "title": "After Fall, Winter"
16}
17{
18 "plot": "Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...",
19 "title": "Summer Wishes, Winter Dreams"
20}
21{
22 "plot": "1183 AD\:\ King Henry II's three sons all want to inherit the throne, but he won't commit to a choice. They and his wife variously plot to force him.",
23 "title": "The Lion in Winter"
24}
25{
26 "plot": "Felicie and Charles have a serious if whirlwind holiday romance. Due to a mix-up on addresses they lose contact, and five years later at Christmas-time Felicie is living with her mother in ...",
27 "title": "A Tale of Winter"
28}
29{
30 "plot": "A mysterious creature is killing a farmer's livestock.",
31 "title": "In the Winter Dark"
32}
33{
34 "plot": "Sean is a little duck with a big problem. Due to a mishap with a jet aircraft Sean misses the annual migration South and has to face the winter alone. However, he is befriended by a water ...",
35 "title": "The First Snow of Winter"
36}
37{
38 "plot": "A renowned artist must uncover a young dancer's secrets in order to truly capture her likeness for a commissioned work.",
39 "title": "A Year Ago in Winter"
40}

이 결과에서 inter 문자가 title 또는 plot 필드의 단어 끝에 나타납니다. Atlas Search는 분석기로 구분된 단어의 오른쪽에서 시작하는 titleplot 필드에 대해 생성한 토큰에 대해 검색어를 매칭하므로 지정된 쿼리 문자열로 끝나는 결과를 반환합니다.

1{
2 "plot": "A 1960s hipster secret agent is brought out of cryofreeze to oppose his greatest enemy in the 1990s, where his social attitudes are glaringly out of place.",
3 "title": "Austin Powers\:\ International Man of Mystery"
4}
5{
6 "plot": "On an isolated lake, an old monk lives on a small floating temple. The wise master has also a young boy with him who learns to become a monk. And we watch as seasons and years pass by.",
7 "title": "Spring, Summer, Fall, Winter... and Spring"
8}
9{
10 "plot": "Rita, a middle aged New York City homemaker, finds herself in an emotional crisis which forces her to re-examine her life, as well as her relationships with her mother, her eye doctor ...",
11 "title": "Summer Wishes, Winter Dreams"
12}
13{
14 "plot": "A mysterious creature is killing a farmer's livestock.",
15 "title": "In the Winter Dark"
16}
17{
18 "plot": "Locked up and isolated, constantly exposed and threatened to be killed, for the first time in his life Lazaro understood that he was a free man.",
19 "title": "Richness of Internal Space"
20}
21{
22 "plot": "A graduate student (Nicholson) copes with a recent breakup by conducting interviews with various men.",
23 "title": "Brief Interviews with Hideous Men"
24}
25{
26 "plot": "As Steve Rogers struggles to embrace his role in the modern world, he teams up with another super soldier, the black widow, to battle a new threat from old history\:\ an assassin known as the Winter Soldier.",
27 "title": "Captain America\:\ The Winter Soldier"
28}
29{
30 "plot": "On a cold winter day a mysterious stranger shows up at the Witting Farm. He is John Witting, the father of Jacob Witting who abandoned Jacob and his mother when Jacob was little. Jacob is ...",
31 "title": "Sarah, Plain and Tall\:\ Winter's End"
32}
33{
34 "plot": "The story of programming prodigy and information activist Aaron Swartz, who took his own life at the age of 26.",
35 "title": "The Internet's Own Boy\:\ The Story of Aaron Swartz"
36}
37{
38 "plot": "Out of work actor Joe volunteers to help try and save his sister's local church for the community by putting on a Christmas production of Hamlet, somewhat against the advice of his agent ...",
39 "title": "A Midwinter's Tale"
40}

이 결과에서는 inter 문자가 title 또는 plot 필드의 단어 어딘가에 나타납니다. Atlas Search는 titleplot 필드에 대해 생성한 3 ~ 7 길이의 토큰과 검색어를 일치시키기 때문에 지정된 쿼리 문자열이 포함된 단어가 포함된 결과를 반환합니다.

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

다음 쿼리를 복사하여 Query Editor에 붙여 넣은 다음 Query Editor에서 Search 버튼을 클릭합니다.

[
{
"$searchMeta": {
"facet": {
"operator": {
"autocomplete": {
"query": "Gravity",
"path": "title"
}
},
"facets": {
"titleFacet": {
"type": "string",
"path": "title"
}
}
}
}
}
]

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1db.movies.aggregate([{
2 $searchMeta: {
3 "facet": {
4 "operator": {
5 "autocomplete": {
6 "query": "Gravity",
7 "path": "title"
8 }
9 },
10 "facets": {
11 "titleFacet": {
12 "type": "string",
13 "path": "title"
14 }
15 }
16 }
17 }
18}])

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

movies 컬렉션의 Aggregations 탭에서 드롭다운에서 단계를 선택하고 해당 단계에 대한 쿼리를 추가하여 다음 각 파이프라인 단계를 구성합니다.

파이프라인 단계
쿼리
$searchMeta
{
facet: {
operator: {
autocomplete: {
path: 'title',
query: 'Gravity'
}
},
facets: {
titleFacet: {
type: 'string',
path: 'title'
}
}
}
}

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1using MongoDB.Bson;
2using MongoDB.Bson.Serialization.Attributes;
3using MongoDB.Bson.Serialization.Conventions;
4using MongoDB.Driver;
5using MongoDB.Driver.Search;
6
7public class AutocompleteFacetExample
8{
9 private const string MongoConnectionString = "<connection-string>";
10
11 public static void Main(string[] args)
12 {
13 // allow automapping of the camelCase database fields to our MovieDocument
14 var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
15 ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);
16
17 // connect to your Atlas cluster
18 var mongoClient = new MongoClient(MongoConnectionString);
19 var mflixDatabase = mongoClient.GetDatabase("sample_mflix");
20 var moviesCollection = mflixDatabase.GetCollection<MovieDocument>("movies");
21
22 // define and run pipeline
23 var results = moviesCollection.Aggregate()
24 .SearchMeta(Builders<MovieDocument>.Search.Facet(
25 Builders<MovieDocument>.Search.Autocomplete(movie => movie.Title, "Gravity"),
26 Builders<MovieDocument>.SearchFacet.String("titleFacet", movie => movie.Title, 100)))
27 .Single();
28
29 // print results
30 Console.WriteLine(results.ToJson());
31 }
32}
33
34[BsonIgnoreExtraElements]
35public class MovieDocument
36{
37 [BsonIgnoreIfDefault]
38 public ObjectId Id { get; set; }
39 public string Title { get; set; }
40}

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1package main
2
3import (
4 "context"
5 "fmt"
6
7 "go.mongodb.org/mongo-driver/bson"
8 "go.mongodb.org/mongo-driver/mongo"
9 "go.mongodb.org/mongo-driver/mongo/options"
10)
11
12func main() {
13 // connect to your Atlas cluster
14 client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("<connection-string>"))
15 if err != nil {
16 panic(err)
17 }
18 defer client.Disconnect(context.TODO())
19
20 // set namespace
21 collection := client.Database("sample_mflix").Collection("movies")
22
23 // define pipeline stages
24 searchMetaStage := bson.D{{"$searchMeta", bson.M{
25 "facet": bson.M{
26 "operator": bson.M{
27 "autocomplete": bson.M{
28 "path": "title", "query": "Gravity",
29 },
30 },
31 "facets": bson.M{
32 "titleFacet": bson.M{
33 "path": "title", "type": "string",
34 },
35 },
36 },
37 }}}
38
39 // run pipeline
40 cursor, err := collection.Aggregate(context.TODO(), mongo.Pipeline{searchMetaStage})
41 if err != nil {
42 panic(err)
43 }
44
45 // print results
46 var results []bson.D
47 if err = cursor.All(context.TODO(), &results); err != nil {
48 panic(err)
49 }
50 for _, result := range results {
51 fmt.Println(result)
52 }
53}

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1import com.mongodb.client.MongoClient;
2import com.mongodb.client.MongoClients;
3import com.mongodb.client.MongoCollection;
4import com.mongodb.client.MongoDatabase;
5import org.bson.Document;
6
7import java.util.Arrays;
8
9public class FacetAutocompleteExample {
10 public static void main(String[] args) {
11 // connect to your Atlas cluster
12 String uri = "<connection-string>";
13
14 try (MongoClient mongoClient = MongoClients.create(uri)) {
15 // set namespace
16 MongoDatabase database = mongoClient.getDatabase("sample_mflix");
17 MongoCollection<Document> collection = database.getCollection("movies");
18
19 // define pipeline
20 Document agg = new Document("$searchMeta", new Document("facet",
21 new Document("operator",
22 new Document("autocomplete",
23 new Document("path", "title")
24 .append("query", "Gravity")))
25 .append("facets",
26 new Document("titleFacet",
27 new Document("type", "string").append("path", "title"))
28 )));
29 // run pipeline and print results
30 collection.aggregate(Arrays.asList(agg))
31 .forEach(doc -> System.out.println(doc.toJson()));
32
33 }
34 }
35}

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1import com.mongodb.client.model.Aggregates.limit
2import com.mongodb.client.model.Aggregates.project
3import com.mongodb.client.model.Filters.eq
4import com.mongodb.client.model.Projections.*
5import com.mongodb.kotlin.client.coroutine.MongoClient
6import kotlinx.coroutines.runBlocking
7import org.bson.Document
8
9fun main() {
10 val uri = "<connection-string>"
11 val mongoClient = MongoClient.create(uri)
12 val database = mongoClient.getDatabase("sample_mflix")
13 val collection = database.getCollection<Document>("movies")
14
15 runBlocking {
16 val agg = Document(
17 "\$searchMeta", Document(
18 "facet",
19 Document(
20 "operator",
21 Document(
22 "autocomplete",
23 Document("path", "title")
24 .append("query", "Gravity")
25 )
26 )
27 .append(
28 "facets",
29 Document(
30 "titleFacet",
31 Document("type", "string").append("path", "title")
32 )
33 )
34 )
35 )
36
37 val resultsFlow = collection.aggregate<Document>(listOf(agg))
38 resultsFlow.collect { println(it) }
39 }
40 mongoClient.close()
41}

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1const { MongoClient } = require("mongodb");
2
3// connect to your Atlas cluster
4const uri =
5 "<connection-string>";
6
7const client = new MongoClient(uri);
8
9async function run() {
10 try {
11 await client.connect();
12
13 // set namespace
14 const database = client.db("sample_mflix");
15 const coll = database.collection("movies");
16
17 // define pipeline
18 const agg = [{$searchMeta: {facet: {
19 operator: {
20 autocomplete: {path: "title", query: "Gravity"}
21 },
22 facets: {
23 titleFacet: {type: "string", path: "title"}
24 }}}}];
25 // run pipeline
26 const result = coll.aggregate(agg);
27
28 // print results
29 await result.forEach((doc) => console.dir(JSON.stringify(doc)));
30 } finally {
31 await client.close();
32 }
33}
34run().catch(console.dir);

다음 쿼리는 $searchMeta 단계를 사용하여 movies 컬렉션의 title 필드에 Gravity라는 용어가 포함된 영화의 고유 값을 반환합니다. 이 쿼리의 인덱스 정의는 자동 완성문자열 패싯 유형이 모두 title 필드에 있는 문자열 패싯 인덱스에서 반환되는 결과를 제한합니다.

1import pymongo
2
3# connect to your Atlas cluster
4client = pymongo.MongoClient('<connection-string>')
5
6# define pipeline
7pipeline = [{"$searchMeta": {
8 "facet": {
9 "operator": {
10 "autocomplete": {"path": "title", "query": "Gravity"}
11 },
12 "facets": {
13 "titleFacet": {"type": "string", "path": "title"}
14 }}}}]
15# run pipeline
16result = client["sample_mflix"]["movies"].aggregate(pipeline)
17
18# print results
19for i in result:
20 print(i)
count: Object
lowerBound: 5
facet: Object
titleFacet: Object
buckets: Array (3)
0: Object
_id: "Gravity"
count: 3
1: Object
_id: "Defying Gravity"
count: 1
2: Object
_id: "Laws of Gravity"
count: 1

Search Tester는 반환하는 문서의 모든 필드를 표시하지 않을 수 있습니다. 쿼리 경로에 지정한 필드를 비롯하여 모든 필드를 보려면 결과에서 문서를 펼칩니다.

1[{
2 count: { lowerBound: Long("5") },
3 facet: {
4 titleFacet: {
5 buckets: [
6 { _id: 'Gravity', count: Long("3") },
7 { _id: 'Defying Gravity', count: Long("1") },
8 { _id: 'Laws of Gravity', count: Long("1") }
9 ]
10 }
11 }
12}]
1[{
2 count: { lowerBound: Long("5") },
3 facet: {
4 titleFacet: {
5 buckets: [
6 { _id: 'Gravity', count: Long("3") },
7 { _id: 'Defying Gravity', count: Long("1") },
8 { _id: 'Laws of Gravity', count: Long("1") }
9 ]
10 }
11 }
12}]
1{
2 "count" : {
3 "lowerBound" : NumberLong(5),
4 "total" : null
5 },
6 "facet" : {
7 "titleFacet" : {
8 "buckets" : [
9 {
10 "_id" : "Gravity",
11 "count" : NumberLong(3)
12 },
13 {
14 "_id" : "Defying Gravity",
15 "count" : NumberLong(1)
16 },
17 {
18 "_id" : "Laws of Gravity",
19 "count" : NumberLong(1)
20 }]
21 }
22 }
23}
1[
2 {
3 count [{
4 lowerBound 5}
5 ]
6 }
7 {
8 facet [{
9 titleFacet [{
10 buckets [
11 [{_id Gravity} {count 3}]
12 [{_id Defying Gravity} {count 1}]
13 [{_id Laws of Gravity} {count 1}]
14 ]
15 }]}]
16 }
17]
1{
2 "count": {
3 "lowerBound": 5
4 },
5 "facet": {
6 "titleFacet": {
7 "buckets": [
8 {
9 "_id": "Gravity",
10 "count": 3
11 },
12 {
13 "_id": "Defying Gravity",
14 "count": 1
15 },
16 {
17 "_id": "Laws of Gravity",
18 "count": 1
19 }]
20 }
21 }
22}
1Document{{count=Document{{lowerBound=5}},
2facet=Document{{titleFacet=Document{{buckets=[Document{{_id=Gravity,
3count=3}}, Document{{_id=Defying Gravity, count=1}}, Document{{_id=Laws
4of Gravity, count=1}}]}}}}}}
1'{
2 "count":{
3 "lowerBound":5
4 },
5 "facet":{
6 "titleFacet":{
7 "buckets":[
8 {
9 "_id":"Gravity",
10 "count":3
11 },
12 {
13 "_id":"Defying Gravity",
14 "count":1
15 },
16 {
17 "_id":"Laws of Gravity",
18 "count":1
19 }
20 ]
21 }
22 }
23 }'
1{
2 'count': {'lowerBound': 5},
3 'facet': {
4 'titleFacet': {
5 'buckets': [
6 {
7 '_id': 'Gravity',
8 'count': 3
9 },
10 {
11 '_id': 'Defying Gravity',
12 'count': 1
13 },
14 {
15 '_id': 'Laws of Gravity',
16 'count': 1
17 }]
18 }
19 }
20}

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

[
{ title: 'Gravity' },
{ title: 'Gravity' },
{ title: 'Gravity' },
{ title: 'Defying Gravity' },
{ title: 'Laws of Gravity' }
]

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

[
{ title: 'Gravity' },
{ title: 'Gravity' },
{ title: 'Gravity' },
{ title: 'Defying Gravity' },
{ title: 'Laws of Gravity' }
]

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

{ "title" : "Gravity" }
{ "title" : "Gravity" }
{ "title" : "Gravity" }
{ "title" : "Defying Gravity" }
{ "title" : "Laws of Gravity" }

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

[{title Gravity}],
[{title Gravity}],
[{title Gravity}],
[{title Defying Gravity}],
[{title Laws of Gravity}]

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

{"title": "Gravity"}
{"title": "Gravity"}
{"title": "Gravity"}
{"title": "Defying Gravity"}
{"title": "Laws of Gravity"}

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

Document{{title=Gravity}}
Document{{title=Gravity}}
Document{{title=Gravity}}
Document{{title=Defying Gravity}}
Document{{title=Laws of Gravity}}

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

{ title: 'Gravity' }
{ title: 'Gravity' }
{ title: 'Gravity' }
{ title: 'Defying Gravity' }
{ title: 'Laws of Gravity' }

Atlas Search에서 title 필드에 Gravity이라는 텀이 포함된 문서를 반환합니다. 결과의 count 필드는 컬렉션에 포함된 동일한 제목의 문서 수를 나타냅니다. 결과에서 Atlas Search는 컬렉션에서 제목이 Gravity인 문서 3개를 찾았지만 Atlas Search는 중복된 제목을 생략하고 일치하는 문서 하나만 반환했습니다.

아래 결과와 같이 중복된 제목을 보려면 패싯 없이 앞의 자동 완성 연산자 쿼리를 실행하고 $search 단계를 대신 사용합니다. 또한 $project 단계를 사용하여 title을 제외한 모든 필드를 제외해야 합니다.

{ 'title': 'Gravity' }
{ 'title': 'Gravity' }
{ 'title': 'Gravity' }
{ 'title': 'Defying Gravity' }
{ 'title': 'Laws of Gravity' }

돌아가기

2. 연산자 및 수집기 사용