Search query for a contents in the file

I indexing the contents of PDF files using FSCrawler.Now the content of the whole PDF file is stored in the content key in elastic.
Below is a sample record.

    "content": "\n\n\n            WHY TRAVEL INSURANCE?\n\nAn ideal holiday is a balance of planning and enjoyment. Travel Insurance plan plays a pivotal role in the success \n\nof your trip and can make your journey secure and stress free.\n\nThe expenses incurred in a foreign land for availing medical/health care facilities are exorbitant.",
    "meta": {
      "author": "1001562",
      "title": "014725MI_Travel Insurance Jacket & Inserts_HS_For PDF",
      "date": "2015-01-13T00:44:11.000+0000",
      "format": "application/pdf; version=1.5",
      "creator_tool": "PScript5.dll Version 5.2.2",
      "created": "2015-01-13T00:44:11.000+0000"
    "file": {
      "extension": "pdf",
      "content_type": "application/pdf",
      "created": "2018-08-24T11:06:00.000+0000",
      "last_modified": "2018-08-24T11:06:00.000+0000",
      "last_accessed": "2020-05-13T11:09:55.000+0000",
      "indexing_date": "2020-05-13T11:25:12.658+0000",
      "filesize": 761476,
      "filename": "int_travel_brochure.pdf",
      "url": "file:///home/***/***/***/elk/pdf/***/int_travel_brochure.pdf"
    "path": {
      "root": "d533120a7a923efe757b567512e5639",
      "virtual": "/int_travel_brochure/int_travel_brochure.pdf",
      "real": "/home/****/***/***/elk/pdf/***/int_travel_brochure.pdf"

I want to fetch 5 lines before and after the exact search term which will be received.
If journey is inputed i want to fetch 5 lines before and after.Will i be able to increase from 5 to 10 or reduce to 2 lines?

There's no concept of "lines" as per say. You just have here a flat content field.

But may be you can solve the use case you are trying to solve by using the highlighting feature?

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