I am using elasticsearch 1.2.1 and I want to do a search from javascript with several fields , for instance, by title and content.
My code is:
var data = { q: 'title: test};
$.ajax({
data: data,
url: http://localhost:9200/_search,
type: 'GET',
success: function (data) {
$.each(data.hits.hits, function(position,hit) {
$("#<portlet:namespace/>search-pattern").append( '<li>' + hit._source.title + '</li>' );
});
}
});
But in addition to search for a title also want to look for the content field .
What should be the value for the attribute data in order to search not only by the field 'title' but also by the field 'content'?
Someone can help me?
Thanks in advance
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.