2017-09-14 1 views
0

Ruby에서 Elasticsearch 보석을 사용하여 탄성 검색 PUT을 사용하여 데이터를 삽입하려하지만 메소드를 찾을 수 없습니다. 오류가 발생합니다.ruby를 사용하여 탄성 검색에 데이터를 삽입하는 방법

Here is the sample code: 

def self.insert_data_in_es 
    name = (here I am giving the url) 
    body = (actual data) 
    Elasticsearch::API::Indices::Actions.put_template(name: name, body: 
    body) 

end 

Error : 
NoMethodError: undefined method `put_template' for Elasticsearch::API::Indices::Actions:Module 

다른 방법이 있습니까?

답변

1

Actions이 (가) Elasticsearch::API::Indices::IndicesClient에 포함 된 모듈 일 뿐이므로이 오류가 발생합니다.

당신은 당신의 클라이언트를 초기화하고 다음과 같이 호출한다 :

client.indicies.put_template(args) 

어쨌든, 내가보기 엔 chewy 좀보고 당신을 추천합니다. toptal에 의해 유지되는 매우 멋진 탄성 찾기 젬입니다.

관련 문제