Plain Highlighter "order":"none" is not working

Hi,

I have created below test_plain_highlighter index. I want highlighted fragments should appear in order as they appear in the field using Plain Highlighter.

I have tried below option,

  • Set "order":"none" in highlight query (as shown in below query).
  • No order is defined in highlight query.
  • Set "order":"score" in highlight query.

But, It always gives highlighted fragments SORTED based on SCORE. I want it in order as they appear in the field. Please help me out.

order

Sorts highlighted fragments by score when set to score . By default, fragments will be output in the order they appear in the field (order: none ). Setting this option to score will output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores. See the document How highlighters work internally for more details how different highlighters find the best fragments.

PUT test_plain_highlighter 
{}

POST /test_plain_highlighter/_doc/1
{
  "description" : "Lorem Ipsum string Generator that helps to create dummy text for all layout needs. In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to Apple's Pages and Keynote software employs such jumbled text as sample screenplay layout. search facial Lorem ipsum is also featured on Joomla. Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it search string over 2000 years old."
}

REQUEST

POST /test_plain_highlighter/_search
{
  "highlight": {
    "order": "none",
    "type": "plain",
    "fields": {
      "*": {}
    },
    "fragment_size": 50
  },
  "query": {
    "match": {
      "description": "search string"
    }
  },
  "_source": ""
}

RESPONSE

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.79659015,
    "hits" : [
      {
        "_index" : "test_plain_highlighter",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.79659015,
        "_source" : { },
        "highlight" : {
          "description" : [
            ", making it <em>search</em> <em>string</em> over 2000 years old.",
            "Lorem Ipsum <em>string</em> Generator that helps to create",
            " layout. <em>search</em> facial Lorem ipsum is also"
          ]
        }
      }
    ]
  }
}

RECEIVED Highlighted Fragment:
[
", making it <em>search</em> <em>string</em> over 2000 years old.",
"Lorem Ipsum <em>string</em> Generator that helps to create",
" layout. <em>search</em> facial Lorem ipsum is also"
]
EXPECTED Highlighted Fragment:
[
"Lorem Ipsum <em>string</em> Generator that helps to create",
" layout. <em>search</em> facial Lorem ipsum is also",
", making it <em>search</em> <em>string</em> over 2000 years old."
]

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