Date Highlighting


(Michael Young) #1

We are seeing an issue where exact matches on fields of type "date" do not have highlighting. Is this a known issue? Is it working as intended? Or is there some configuration item I need to change?

We are running Elasticsearch 1.5.2.


(Nik Everett) #2

The highlighters are pretty text based so I'd honestly be surprised if
highlighting dates got you anything. What are you expecting?

Nik


(Michael Young) #3

Well dates are represented to the users as a string. The expectation was that the date tokens would be highlighted as any other token would be highlighted. The engine knows where the matching token is, whether it's a date or not, so I don't see why the highlighter wouldn't work.

Our dates are generally represented as YYYYMMDD in the data. When submit a query as"mydatefield: 20150602", the expectation was that the returned highlighted request would have the appropriate "" markings as any other text highlighting would.


(Michael Young) #4

To add some more clarification, we have have also tried the query without using a date field. For example, we have a "summary" field which is used to provide the results page "best passage" for each hit. This field might have the following content: "Today the weather is nice. I want to go hiking. I can't wait for 20150602 to come around".

When we query for "20150602", we clearly get hits. However, the "20150602" is not highlighted. In this case it is a string, not a date. If we change our query to "hiking", highlighting works fine.


(Nik Everett) #5

That should work. Highlighters are a bit wild west though and don't get much support. You should probably file that as an issue with curl reproduction steps.

Highlighting the date field when you search it is the thing I thought you were doing and I'm pretty sure that won't work by default. Some highlighters might try to convert the date to a string and then do text highlighting against that but its unlikely to be what you really want. Something like "wrap the whole date in a <em> tag if it mathes" would be pretty simple to implement but likely doesn't exist.


(Michael Young) #6

Nik,

Thank you for the reply. It seemed like a relatively simple thing to do, so I assumed it existed. That's why I thought it best to ask. :smile:

Thank you for the replies!

Michael


(system) #7