[英]ElasticSearch and MongoDB
I'm willing to run full-text queries in MongoDB, using ElasticSearch. 我愿意使用ElasticSearch在MongoDB中运行全文查询。 I found some guides about how to setup ElasticSearch using this , but I have a few questions. 我找到了一些关于如何使用它设置ElasticSearch的指南,但我有几个问题。
1: I'm supposed to run this 1:我应该跑这个
curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{
"type": "mongodb",
"mongodb": {
"db": "testmongo",
"collection": "person"
},
"index": {
"name": "mongoindex",
"type": "person"
}
}'
to make ElasticSearch index that collection. 使ElasticSearch索引该集合。 Do I need to run this more than once? 我需要不止一次运行吗? (Every time my collection is updated? Once per day?) (每次我的收藏更新?每天一次?)
2: Is there full support for paging and ordering? 2:是否完全支持分页和排序? I'd like to search for something, but limiting the result to N results per page, and skip some pages. 我想搜索某些内容,但将结果限制为每页N个结果,并跳过一些页面。 Also, I'd like to order by any field. 另外,我想在任何领域订购。
3: My data looks like this: 3:我的数据如下:
{
question: 'text here',
date: '01/01/2000 01:01',
title: 'Some title',
client: 'name',
assigned_to: ['name1', 'name2', 'name3'],
answers: [
{answer: 'bla bla'},
{answer: 'bla bla'},
{answer: 'bla bla'}
]
}
Will I be able to search in question
, title
and all the answers
? 我可以搜索question
, title
和所有answers
吗?
no you need not run that every time a collection gets updated. 不管你每次更新集合都不需要运行它。 a index is refreshed according to the refresh interval in config or manually by invoking "_refresh" 根据config中的刷新间隔刷新索引或通过调用“_refresh”手动刷新索引
yes there is support for paging,sorting using fields "from", "size", "sort" in the query please see 是的,支持分页,在查询中使用“from”,“size”,“sort”字段排序请参阅
yes you can search in anyfield please see http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query/ 是的,你可以在任何领域搜索,请参阅http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.