Highlighting copied fields in percolate queries

Hi,

I'm working with a use case where the results of percolate queries must been highlighted. With normal fields it works fine but I have problems with fields which content has been copied from other field.

Here is an example.

The mappings

"mappings": {
        "title" : {
          "type" : "text",
          "fields" : {
            "prefix" : {
              "type" : "text",
              "analyzer" : "normal_prefix",
              "search_analyzer" : "normal_query"
            }
          },
          "copy_to" : [
            "title_sensible"
          ],
          "analyzer" : "normal",
          "search_analyzer" : "normal_query"
        },
        "title_sensible" : {
          "type" : "text",
          "store" : true,
          "fields" : {
            "prefix" : {
              "type" : "text",
              "analyzer" : "sensible_prefix",
              "search_analyzer" : "sensible_query"
            }
          },
          "analyzer" : "sensible",
          "search_analyzer" : "sensible_query"
        },
        "tquery" : {
          "type" : "percolator"
        }
}

The stored queries

{
    "tquery" : {
        "match" : {
            "title" : "precio"
        }
    } 
}
{
    "tquery" : {
        "match" : {
            "title_sensible" : "Madrid"
        }
    } 
}

The search request

{
  "query": {
    "percolate": {
      "field": "tquery",
      "document": {
        "title": "La subida de precio del alquiler en Madrid está provocando una marea"
      }
    }
  },
  "highlight": {
        "fields": {
          "title" : {}
        }
  }
}

And the results

    "hits" : [
      {
        "_index" : "tracking-i6",
        "_type" : "_doc",
        "_id" : "AAEFE2C9ED1CED7F5D748C1DA8A104B9",
        "_score" : 0.13076457,
        "_source" : {
          "tquery" : {
            "term" : {
              "title" : {
                "value" : "precio",
                "boost" : 1.0
              }
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        },
        "highlight" : {
          "title" : [
            "La subida de <em>precio</em> del alquiler en Madrid está provocando una marea"
          ]
        }
      },
      {
        "_index" : "tracking-i6",
        "_type" : "_doc",
        "_id" : "6DAD52D208A659E0C52C6326C84A5B59",
        "_score" : 0.13076457,
        "_source" : {
          "tquery" : {
            "term" : {
              "title_sensible" : {
                "value" : "Madrid",
                "boost" : 1.0
              }
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      }
]

The percolate query works great but the result is not been highlighted in the title_sensible case.

Any idea? Am I doing anything wrong?

Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.