fullscale / elastic.js

A JavaScript implementation of the elasticsearch Query DSL
http://docs.fullscale.co/elasticjs/
MIT License
654 stars 163 forks source link

Support Highlight Query #85

Open vp-hwood opened 9 years ago

vp-hwood commented 9 years ago

Add a .query method to the Highlight class, to support the highlight_query field. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html#_highlight_query

waldemarnt commented 9 years ago

We dont have this behavior ? like this http://docs.fullscale.co/elasticjs/ejs.Highlight.html

vp-hwood commented 9 years ago

I know about ejs.Highlight. What I'm missing is the method that adds the highlight_query field. For example I want to build

{
  "query": ...,
  "highlight": {
    "fragment_size": 300,
    "highlight_query": {"query_string": {"query": myQueryString}},
     "fields": fields
  },
}

In elastic.js I would do (but can't)

ejs.Request()
  .query(ejs...)
  .highlight(ejs.Highlight(fields)
    .fragmentSize(300)
    .query(ejs.QueryStringQuery(myQueryString))) // .query does not exist in elastic.js!
waldemarnt commented 9 years ago

So, right, does make sense :D

kuehn-sba commented 8 years ago

+1 Please add the method that adds the highlight_query field. Thanks.