KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been trying to figure out how to correctly request data from elasticsearch using a jQuery AJAX call. I either get an parsing error or I'll get every document in the index I'm searching under. $(document).ready(function() { var timer = null; function dicom_search() { var box = $('#s_box').val(); $.ajax({ url: 'http://localhost:9200/dicoms/dicoms/_search', type: 'POST', //contentType: 'application/json; charset=UTF-8', crossDomain: true, dataType: 'json', data: { query:{match:{_all:$('#s_box').val()}}, pretty: true, fields: '_id' }, success: function(response) { var data = response.hits.hits; var doc_ids = []; var source = null; var content = ''; if (data.length > 0) { for (var i = 0; i < data.length; i++) { source = data[i].fields; doc_ids.push(source._id); content = content + ' ' + source._id + '<br />'; } $('#res').removeClass('text-error').addClass('text-success').html(content); } else { $('#res').removeClass('text-success').addClass('text-error').html('No results found.'); } } }); } $('#s_box').live('keyup', function() { if (timer) { clearTimeout(timer); } timer = setTimeout(dicom_search, 600); }); }); Here is my error: { "error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[GUiivW0TQVSNv2HQyxu8Vw][dicoms][0]: SearchParseException[[dicoms][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]]; nested: ElasticSearchParseExce
Tags (comma-separated)
Save Edits
Cancel