Hi guys,
I would first thank you for your help.
Here is my problem : I have an index of products and I request elasticsearch to retreive me all products who match with an array of queries. But I would know for each products which phrase of the array query matched for the product. I can highlight what matched in the product, but I don't want to highlight the product. I want to "highlight" the phrase of the query who matched.
There is my ES query :
> curl -XGET "http://localhost:9200/elastic/products/_search?pretty" -d'
> {
> "size" : 20,
> "query" : {
> "filtered" : {
> "query" : {
> "bool" : {
> "should" : [ {
> "match" : {
> "name" : {
> "query" : "[plombier, voiture occasion, téléphone, ordinateur, dentiste]",
> "type" : "boolean"
> }
> }
> }, {
> "match" : {
> "description" : {
> "query" : "[plombier, voiture occasion, téléphone, ordinateur, dentiste]",
> "type" : "boolean"
> }
> }
> } ]
> }
> },
> "filter" : {
> "geo_distance" : {
> "geolocatedPoint" : [ 5.1753719, 50.6366569 ],
> "distance" : "200.0km"
> }
> }
> }
> }
> }'
So I would like to know for each product if this is the 1st element of the array who matched or the 4th or etc...
Thanks a lot, I hope you'll can help me.
PS : (I'm using ES with spring-data-elasticsearch but it's not really relevant I think).