2014-09-03 6 views
1

MongoDB에서 ElasticSearch.Mongo River 플러그인으로 데이터를 내보내고 싶습니다. 컬렉션의 덤프를 먼저 가져 와서 복원하는 옵션이 있습니다.하지만 Mongo River를 사용하고 싶지 않습니다. 플러그인, 나는 elaster을 사용하여 MongoDB에서 Elasticsearch로 데이터를 내보내고 있습니다.MongoDB에서 ElasticSearch로 내보내기

  • 탄성 검색 버전 - 1.3.2
  • Node.js를 버전 - v0.11.8 사전
  • MongoDB를 버전 - 2.4.x에서

내가 실행 : ./bin/elaster는 말한다 :

{ 
    [Error: MapperParsingException[object mapping for [collection] tried to parse as object, but got EOF, has a concrete value been provided to it?]] 
    message: 'MapperParsingException[object mapping for [collection] tried to parse as object, but got EOF, has a concrete value been provided to it?]' 
} 

내 Elaster 구성은 다음과 같습니다

,536,913 63,210
module.exports = { 

    mongo: { 
    connection: 'mongodb://127.0.0.1:27017/times' 
    }, 

    elastic: { 
    host: { 
     host: '127.0.0.1' 
    }, 
    requestTimeout: 5000 
    }, 

    collections: [ 
    { 
     name: "walldisplay", 
     index: "walldisplay", 
     type: "collection", 
     fields: [ 
     "_id", 
     "wat", 
     "wct", 
     "u", 
     "i", 
     "cd" 
     ], 
     mappings: { 
     "collection": { 
      "properties": { 
      "wat":{ 
       'type':'string', 
       'index': 'not_analyzed' 
      }, 
      "wct":{ 
       'type':'string', 
       'index': 'not_analyzed' 
      }, 
      "u":{ 
       "type" : "object", 
       "dynamic" : true, 
       "properties":{ 
       "_id":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "n":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "st":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "id":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       } 
       }, 
       "index":"not_analyzed" 
      }, 
      "i":{ 
       "type" : "nested", 
       "include_in_parent" : true, 
       "properties":{ 
       "_id":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "ti":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "st":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "n":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       }, 
       "cst":{ 
        'type':'string', 
        'index': 'not_analyzed' 
       } 
       } 
      }, 
      "cd":{ 
       'type':'long', 
       'index': 'not_analyzed' 
      }, 
      } 
     } 
     } 
    } 
    ] 
}; 

또한이 유형과 "walldisplay"와 같은 인덱스로 "수집"을 정의한 이후에 온라인

{ 
    "_id": ObjectId("5406a47970b17246b9a293e1"), 
    "cd": 1409721465, 
    "i": [ 
    { 
     "_id": ObjectId("50f693d17deed44cf000007f"), 
     "st": "seo-title", 
     "ti": "title", 
     "n": "categoryname", 
     "cst": "category-seotitle", 
     "r": null, 
     "c": null 
    }, 
    { 
     "_id": ObjectId("50f693d17deed44cf000007f"), 
     "st": "seo-title", 
     "ti": "title", 
     "n": "categoryname", 
     "cst": "category-seotitle", 
     "r": null, 
     "c": null 
    }, 
    { 
     "_id": ObjectId("50f693d17deed44cf000007f"), 
     "st": "seo-title", 
     "ti": "title", 
     "n": "categoryname", 
     "cst": "category-seotitle", 
     "r": null, 
     "c": null 
    } 
    ], 
    "u": { 
    "_id": ObjectId("50ce4f79edaffd69e40ee010"), 
    "n": "Richa Sen", 
    "st": "richasen", 
    "id": "d8mzxlp9ekn323l6jg5s8tly1" 
    }, 
    "wat": 1, 
    "wct": 1 
} 

답변

1

샘플 문서를 확인하시기 바랍니다 매핑의 유형은 "모음"보다는이어야한다 "walldisplay".

The put mapping API allows to register specific mapping definition for a specific type

다음 작품

.. 
    mappings:{ 
       "collection":{ 
         "properties":{ 
           ... 
          } 
        } 
       } 
+0

안녕하세요. 회신 해 주셔서 감사합니다. 네, 앞으로 더 나아갈 수있었습니다. 이제 다음과 같은 오류가 발생합니다 {{Error : MapperParsingException [parse [wct]] 실패; 중첩 : NumberFormatException [입력 문자열의 경우 : "i"]; ] 메시지 : 'MapperParsingException [구문 분석하지 못했습니다. [wct]]; 중첩 : NumberFormatException [입력 문자열의 경우 : "i"]; '} 제공된 문서에서 알 수 있듯이 WCT => 정수 값이고 "i"는 배열입니다. – coder

+0

"walldisplay"라는 이름의 색인이 이미 있는지 확인하고 elasticsearch?에 매핑이있는 "collection"을 입력하십시오. 매핑 또는 유형 자체를 삭제하고 다시로드하십시오. – BatScream

+0

예 기존의 모든 매핑을 curl -XDELETE 'http : // localhost : 9200/*/_ mapping/*'로 삭제하고 Elastic Search를 재시작했습니다. 그러나 여전히 동일한 오류가 발생합니다. – coder

0

WCT 필드 번호 유형하지만 하나의 문서가 당신이 그렇게 당신의 WCT 값을 변경하려고 같은 오류가 발생하는 이유 문자열로 WCT 값을 갖는대로 매핑되어 있는지 확인 문자열에서 정수로.

관련 문제