2016-11-12 10 views
0

저는 이것을 angular bootstrap feedback form으로 사용하여 사용자 피드백 데이터를 수집하고 정보를 Elasticsearch에 색인하여 (검색 가능하게하려고합니다).사용자 의견 데이터를 Elasticsearch에 제출하기

그래서 Elasticsearch 내 searchService에, 나는 단순히 한 :

<div class="row"> 
    <div class="col-xs-12"> 
     <div class="alert alert-info" role="alert"> 
     We would love to hear your thoughts and suggestions on what we get right and wrong - it helps us improve our services to you. Your feedback is appreciated and helps us get better! 
     </div> 
    </div> 
    </div> 
    <div class="row"> 
    <div class="col-lg-6"> 
     <!-- DESCRIPTION --> 
     <div class="form-group"> 
     <pre>Model: {{comments | json}}</pre> 
     <label for="description_field" class="control-label">Comment:</label> 
     <textarea class="form-control" placeholder="Please describe your issue or share your feedback!" name="comments" ng-model="comments" style="min-height: 165px;"></textarea> 
     </div> 
     <!-- /DESCRIPTION --> 
     <!-- EMAIL --> 
     <div class="form-group"> 
     <pre>Model: {{email | json}}</pre> 
     <label for="email_field" class="control-label">Email:</label> 
     <input type="text" class="form-control" placeholder="Email" name="email" ng-model="email" /> 
     </div> 
     <!-- /EMAIL --> 
    </div> 

내가 추가 한 NG-모델 :

this.userSearchFeedback = function (userFeedbackForm) { 
    esClient.index({ 
     index: 'searchfeedback-index1', 
     type: 'general', 
     opType: 'index', 
     refresh: true, 
     body: { 
     fields: ['comments', 'email'] 
     } 
    }).then(function(es_return) { 
     console.log('success'); 
    }, function(error) { 
     console.log('error'); 
    }); 
    }; 

userFeedbackForm은 다음과 같습니다 양식의 이름입니다 두 입력을 모두 내 컨트롤러에 추가했습니다.

//initialize feedback form 
$scope.feedback = { 
    comments: '', 
    email: '' 
}; 

이 모듈에는 이미 함수 양식 템플릿을 클릭하여 호출됩니다 ...

function submitButtonPressed(form) { 
console.log("Submit button pressed"); 
console.log(form); 
console.log($scope.feedback.comments);//added 
console.log($scope.feedback.email);//added 

그리고 그 부분은 제가 붙어 있습니다.

내 searchService에서 userSearchFeedback()을 호출하여 양식 데이터를 ES에 인덱싱 할 수 있도록하려면이 함수로 수행해야 할 다른 작업은 무엇입니까?

+0

특정 문제를 정의하지 않았거나 [mcve]에 따라 관련 코드를 모두 표시했습니다. 표시된 양식에는 양식 제어 기능조차 없습니다. 여기에 더 많은 세부 사항이 필요합니다. – charlietfl

+0

@charlietfl 당신의 권리 - 나는 오늘 이렇게 서두른 적이 있었고, 나는 이것을 던졌습니다. 나는 지금 코드를보고 빠져있는 것을 모두 깨닫고있다. 내가 그의 처분을 받으면 나는 다른 사람들이 (그들이 필요하다면) 혜택을 얻을 수 있도록 다시 게시 할 것이다. – user3125823

+0

특정 문제를 알 수없고 해당 문제와 관련된 코드가 제공되지 않으면 누구도 도움을 줄 수 없습니다. – charlietfl

답변

0

위의 사항을 시행 착오 한 후에 게시됩니다. 나는 다른 것을 구할 수 있는지보기로 결정했다. 거기에 is and its amazingly simple 구현해야합니다. 에 제출할 URL을 추가하면됩니다. 몇 분 안에 실행하고 실행했습니다 (일단 URL을 제공해야 함을 깨달았습니다).

HTH 누구.