Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support intervals query with Fast Vector Highlighter #65729

Closed
ZeusFSX opened this issue Dec 2, 2020 · 5 comments
Closed

Support intervals query with Fast Vector Highlighter #65729

ZeusFSX opened this issue Dec 2, 2020 · 5 comments
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories

Comments

@ZeusFSX
Copy link

ZeusFSX commented Dec 2, 2020

I have a document, for example:

{
    "text": "Index Down Jones",
    "title": "Index Down Jones"
}

And my mapping for text and title the same:

  "mappings": {
    "properties": {
      "text": {
        "type": "text",
        "analyzer": "my_analyzer",
        "term_vector": "with_positions_offsets",
        "fields": {
          "exact": {
            "type": "text",
            "term_vector": "with_positions_offsets",
            "analyzer": "default"
          },
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }

My query:

{
    "query": {
        "bool": {
            "should": [
                {
                    "intervals": {
                        "text": {
                            "all_of": {
                                "intervals": [
                                    {
                                        "match": {
                                            "query": "Down"
                                           }
                                    },
                                    {
                                        "match": {
                                            "analyzer": "default",
                                            "max_gaps": 0,
                                            "query": "Jones",
                                            "use_field": "text.exact"
                                        }
                                    }
                                ],
                                "max_gaps": 0,
                                "ordered": False}
                        }
                    }
                },
                {
                    "intervals": {
                        "title": {
                            "all_of": {
                                "intervals": [
                                    {
                                        "match": {
                                            "query": "Down"
                                         }
                                     },
                                    {
                                        "match": {
                                            "analyzer": "default",
                                            "max_gaps": 0,
                                            "query": "Jones",
                                            "use_field": "title.exact"
                                        }
                                    }
                                ],
                                "max_gaps": 0,
                                "ordered": False
                            }
                        }
                    }
                }
            ]
        }
    },
    "highlight": {
        "number_of_fragments": 0,
        "post_tags": ["</em>"],
        "pre_tags": ["<em>"]},
        "fields": {
            "text": {
                "matched_fields": ["text", "text.exact"],
                "type": "fvh"
            },
            "title": {
                "matched_fields": ["title", "title.exact"],
                "type": "fvh"
            }
        }
}

Can you add support to fast vector highlighter when use intervals query?
By the way, when I use unified highlighter elasticsearch highlights fields separately:

"highlight": {
    "text.exact": ["Index Down <em>Jones</em>"],
    "title.exact": ["Index Down <em>Jones</em>"],
    "text": ["Index <em>Down</em> Jones"],
    "title": ["Index <em>Down</em> Jones"]
}
@ZeusFSX ZeusFSX added >enhancement needs:triage Requires assignment of a team area label labels Dec 2, 2020
@ZeusFSX ZeusFSX changed the title Support intervals query with Fast Vector Highlight Support intervals query with Fast Vector Highlighter Dec 2, 2020
@pgomulka pgomulka added the :Search/Search Search-related issues that do not fall into other categories label Dec 4, 2020
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Dec 4, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@pgomulka pgomulka removed Team:Search Meta label for search team needs:triage Requires assignment of a team area label labels Dec 4, 2020
@jimczi
Copy link
Contributor

jimczi commented Dec 18, 2020

The Fast vector highlighter is in maintenance mode so all developments are now made on the unified highlighter.
There are no more activities in Lucene for this highlighter as well so the chance that intervals are handled by this old highlighter are very small. For this reason I hope you don't mind if I close this issue, if something is missing or not working with the unified highlighter please open a new one.

@jimczi jimczi closed this as completed Dec 18, 2020
@ZeusFSX
Copy link
Author

ZeusFSX commented Dec 18, 2020

@jimczi Do you have any advice for highlight, how to merge two fields into one: text and text.exact using unified highlighter?

@jimczi
Copy link
Contributor

jimczi commented Dec 18, 2020

That's tracked in #5172 @ZeusFSX . The fact that the issue is still opened is a good indicator that we want to implement it, however this is a high hanging fruit and we never had the time, due to other prioritization, to address it properly. I am afraid that this will not change in the near future but we'll get to it eventually. The linked issue also provides some workaround in the meantime.

@ZeusFSX
Copy link
Author

ZeusFSX commented Dec 18, 2020

@jimczi Thanks)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

4 participants