简体   繁体   English

来自mongodb的ElasticSearch索引?

[英]ElasticSearch index from mongodb?

I need create index from mongodb. 我需要从mongodb创建索引。 Colection name is Product and have such structure: 集合名称为Product ,具有以下结构:

{
    "_id": ObjectId("5239656f60663de206b1053e"),
    "brand": "<brandName>",
    "category": {
        "$ref": "Category",
        "$id": ObjectId("50cb515760663d3577000043"),
        "$db": "<dbName>" 
     },
     "image": "<imageUrl>",
     "integraId": "<someId>",
     "isActive": <isActive>,
     "name": "<productName>",
     "slug": "<slug>" 
 }

Collection Product have more 30 000 rows, but elasticsearch indexing only ~10 000 rows. 集合Product有3万多行,但是Elasticsearch索引的行只有〜10000行。 My query to create index: 我查询创建索引:

{
  "type": "mongodb",
  "mongodb": {
    "servers": [
      { "host": "127.0.0.1", "port": 27017 }
    ],
    "options": { 
        "secondary_read_preference": true
    },
    "db": "<dbName>",
    "collection": "Product"
  },
  "index": {
    "name": "test",
    "type": "test_type"
  }
}

And just a second question: How can I indexing only some fields (name, category (get row by id from other collection) and brand)? 还有第二个问题:如何仅索引某些字段(名称,类别(从其他集合中按ID获取行)和品牌)?

您可能会在http://groups.google.com/group/elasticsearch/topics或IRC http://www.elasticsearch.org/community/的Google网上论坛中遇到更多的运气

MongoDB has full text search built in experimentally in version 2.4 if you would like to experiment with that: http://docs.mongodb.org/manual/core/index-text/ you may be able to query more effeciently. 如果您想尝试MongoDB的2.4版本中内置的全文本搜索,请执行以下操作: http : //docs.mongodb.org/manual/core/index-text/您可能可以更有效地查询。 I realize this isn't the same as the elasticsearch solution you're looking for but this might be another way to solve the problem. 我意识到这与您要寻找的Elasticsearch解决方案不同,但这可能是解决问题的另一种方法。 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM