2015-01-08 2 views
1

MongoDB 용 Elastic 검색 강을 만들려고합니다. 나는 elasticsearch-mapper-attachmentselasticsearch-river-mongodb 플러그인을 사용하고 있습니다. 내가 가진 문제는 내가 여기Elasticsearch River - java.lang.String을 java.util.Map에 캐스트 할 수 없습니다.

java.lang.String cannot be cast to java.util.Map에 대한 불만을 얻을 수 있습니다 내가 만든 인덱스 : 다음은

[email protected] ~/river $ curl -X PUT "localhost:9200/_river/config_files/_meta" -d @create.json | python -m json.tool 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 220 100 84 100 136 3032 4909 --:--:-- --:--:-- --:--:-- 5230 
{ 
    "_id": "_meta", 
    "_index": "_river", 
    "_type": "config_files", 
    "_version": 1, 
    "created": true 
} 
[email protected] ~/river $ 

: 여기

{ 
    "type": "mongodb", 
    "mongodb": { 
     "collection": "config_files", 
     "db": "tore_dev" 
    }, 
    "index": "config_files" 
} 

는 명령입니다 상태 :

[email protected] ~/river $ curl localhost:9200/_river/config_files/_status | python -m json.tool 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 640 100 640 0  0 30247  0 --:--:-- --:--:-- --:--:-- 33684 
{ 
    "_id": "_status", 
    "_index": "_river", 
    "_source": { 
     "error": "CreationException[Guice creation errors:\n\n1) Error injecting constructor, java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map\n at org.elasticsearch.river.mongodb.MongoDBRiver.<init>(Unknown Source)\n while locating org.elasticsearch.river.mongodb.MongoDBRiver\n while locating org.elasticsearch.river.River\n\n1 error]; nested: ClassCastException[java.lang.String cannot be cast to java.util.Map]; ", 
     "node": { 
      "id": "57f4LnVMSn2xDlo1Es0meQ", 
      "name": "Wicked", 
      "transport_address": "inet[/10.1.23.69:9300]" 
     } 
    }, 
    "_type": "config_files", 
    "_version": 1, 
    "found": true 
} 

답변

0

해결되었습니다. 대신에 나는 인덱스 필드에 pass an object에 필요한

... 
    "index": "config_files" 
    .... 

: 나는 index 필드에 string를 통과했다

{ 
    "type": "mongodb", 
    "mongodb": { 
     "collection": "config_files", 
     "db": "tore_dev" 
    }, 
    "index": { 
     "name": "mongo_index", 
     "type": "config_files" 
    } 
} 

그들은을 설명하는 바와 같이 객체가 아마의 java.util.Map로 Elasticsearch 내부로 표현된다 objects :

다른 언어로 해시, 해시 맵, 사전 또는 연관 배열로 알려져 있습니다.

그래서이 오류 메시지를 설명 java.lang.String cannot be cast to java.util.Map

관련 문제