I am using elasticsearch to search across multiple fields using the java
elasticsearch client:
BaseQueryBuilder queryBuilder;
List<String> fields = new ArrayList<String>();
fields.add("isbn");
fields.add("title");
for (int i = 0; i < 7; i++) {
fields.add("contributor[" + i + "].personname");
}
for (int i = 0; i < 11; i++) {
fields.add("subject[" + i + "].subjectcode");
}
queryBuilder = QueryBuilders.multiMatchQuery(text, fields.toArray(new
String[fields.size()]));
Say the title for a document is "Programming in C++" and i search 'C++'
with the logic above it does not bring the book up in the results, how can
i refine this query to better find the documents with the word 'C++' in it?
I thought it was the special characters in the text but if i search just on
the title field using the following logic (on the single title field) the
results come up correctly (books with the word 'C++' in it come up in top
results):
BaseQueryBuilder queryBuilder =
QueryBuilders.fuzzyLikeThisFieldQuery("title").likeText(request.getTitle());
Ive tried all sorts of things to try get search on multiple fields to
return books with title that contains words like 'C++' or 'C#' in it i.e.
boosting query that boosts the title field higher but then when searching
by contributor (author) it favours title over author and brings back books
who's title matches instead of author.
If anyone can help that would be great! Ive tried everything and have run
out of ideas..
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.