We are trying to find which fields matched a given user search string that is sent as a query_string query. We have been using the explain=true in the request, where the response in the explanation section contains each field where the match was found and we sent it across to present the documents with custom formatting to show the matches. This query takes about 1796ms for a hit count of 717.
Query with explain=true: JSON Editor Online - view, edit and format JSON online
Now, we are trying to improve the response time and looked at the highlight api, but the same query_string takes about 4413ms.
New query with highlight option: JSON Editor Online - view, edit and format JSON online
Looking for some clues on two issues:
- What is causing the slowness with the highlight query?
- The response in this new query does not indicate the partial string that matched in a field:
"highlight" : {
"properties.DESCRIPTION.case_insesitive_keyword" : [
"<em>RES METF 2.05k OHM 1/10W 1% SMD 0603</em>"
],
Here we are expecting that only the 0603 in the above output should have been enclosed with the em tags.
Index stats from dev tools:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open parts SBys4VV9Rr2XzoNvhB8YIw 1 0 24969 0 132.7mb 132.7mb
Regards,
Sheetal