2016-12-20 3 views
1

안녕하세요 저는 MySQL 데이터베이스 테이블에 186000 개 이상의 레코드가있는 lostash 2.X 버전에서 다음 scirp 파일을 사용하고 있습니다.이 .conf 파일을 실행하는 동안 하나의 문서 만 탄성 검색 인덱스로로드됩니다. 내가이 쿼리를 사용할 때이 문서의 ID 분명히 당신이하지 않는 것을 의미 그대로 값 "%{id}"입니다 볼 수MySQL에서 Elasticsearch로 데이터로드

input { 
     jdbc { 
      jdbc_connection_string => "jdbc:mysql://localhost/elasticsearch" 
      jdbc_user => "root" 
      jdbc_password => "empower" 
      #jdbc_validate_connection => true 
      jdbc_driver_library => "/home/wtc082/Documents/com.mysql.jdbc_5.1.5.jar" 
      jdbc_driver_class => "com.mysql.jdbc.Driver" 
      statement => "SELECT * FROM index_part_content_local;" 
      #schedule => "* * * * *" 
      #codec => "json" 
     } 
    } 

output { 
    elasticsearch { 
     index => "mysqltest" 
     document_type => "mysqltest_type" 
     document_id => "%{id}" 
     hosts => "localhost:9200" 
    } 
} 

은 하나의 문서는 지수에게

GET mysqltest/_search 
{ 
    "query": { 
    "match_all": {} 
    } 
} 




{ 
    "took": 14, 
    "timed_out": false, 
    "_shards": { 
    "total": 5, 
    "successful": 5, 
    "failed": 0 
    }, 
    "hits": { 
    "total": 1, 
    "max_score": 1, 
    "hits": [ 
     { 
     "_index": "mysqltest", 
     "_type": "mysqltest_type", 
     "_id": "%{id}", 
     "_score": 1, 
     "_source": { 
      "partnum": "", 
      "property1": "", 
      "property2": "", 
      "color": "", 
      "size": "", 
      "dim": "", 
      "thumburl": "", 
      "catid": "6575", 
      "subcatid": "3813", 
      "termid": "31999", 
      "longdesc": "<ul><li>Equipment and Parts<li>GC32-XD Parts<li>D/V Lock Plate Screw</ul>", 
      "hier1desc": "Heavy Duty Tools/Equipment", 
      "hier2desc": "Other Heavy Duty Equipment", 
      "hier3desc": "Hose Crimping Equipment & Accessories", 
      "aaiabrandid": "BBSC", 
      "aaiabrandname": "Gates", 
      "brandimageurl": "es-logo-sm.jpg", 
      "linecode": "GAT", 
      "descrp": "D/V Lock Plate Screw", 
      "@version": "1", 
      "@timestamp": "2016-12-20T09:16:40.075Z" 
     } 
     } 
    ] 
    } 
} 
+0

받고있는 전체 문서/결과를 표시 할 수 있습니까? – Val

+0

문서를 업데이트했습니다. 사전에 도움을 주셔서 감사합니다. 발 –

답변

1

좋아하다 데이터베이스의 모든 id 열과 데이터베이스의 모든 레코드는 동일한 문서 ID로 인덱싱되므로 한 문서 만 표시되는 이유는 무엇입니까? 당신의 elasticsearch 출력에서 ​​

, 당신은 테이블

document_id => "%{PRIMARY_KEY}" 

의 기본 키가 수정하고이 작동하는 필드를 사용할 수 있는지 확인해야합니다.

+0

OMG ... !!!!! 당신은 ES Val의 신입니다. 도와 줘서 고마워. ..... 언제든지 질문을 올리면 대답 해줄 사람, eveytime. 너의 거대한 팬이 되었네 ........ –

+0

그것이 도움이 되서 기쁩니다. 여기 주위에 매우 날카로운 사람들이 도와 줄 준비가되어 있습니다. ;-) – Val

관련 문제