Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

elasticsearch - Elastic search query help on pagination

Unhandled questions KPI should display top 10 records in descending order also need to add one field for timestamp. And for all additional records there should be pagination available. Members should be able to view additional records by navigating through pagination options.

My requirements is for the pagination record should come like 1 to 10 and 11 to 20 and 21 to 30 like wise in this range I should get the output.

I tried the below query but when I execute the query its not showing up the timestamp field. And it is only giving me the question.keyword. Also If i give the partition range between 11 to 20 it is still showing me the 1st ten records . Whatever range I give I am getting the same output and there is no change in the output

Please correct my below query.

  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "answer.keyword": "UNHANDLED"
          }
        },
        {
          "term": {
            "source.keyword": "On_board"
          }
        }
      ]
    }
  },
  "aggs": {
    "MyBuckets": {
      "terms": {
        "field": "question.keyword",
        "order": {
          "_count": "desc"
        },
        "size": "10"
      },
      "aggs": {
        "MyBuckets": {
          "terms": {
            "field": "timestamp",
            "order": {
              "_count": "desc"
            },
            "size": "10",
            "include": {
              "partition": 11,
              "num_partitions": 20
            }
          }
        }
      }
    }
  }
}```
question from:https://stackoverflow.com/questions/65937759/elastic-search-query-help-on-pagination

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...