# Can I parse text in pdf document before sending it to elasticsearch using FSCrawler

**URL:** https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564
**Category:** Elasticsearch
**Created:** [May 24, 2019, 5:58am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564 "2019-05-24T05:58:35Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 5:58am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/1 "2019-05-24T05:58:35Z")

</div>

Please help.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 6:09am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/2 "2019-05-24T06:09:29Z")

</div>

Yes.

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 6:10am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/3 "2019-05-24T06:10:17Z")

</div>

How can i do it

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 6:31am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/4 "2019-05-24T06:31:05Z")

</div>

Can you show me some examples . Like if I want to extract Phone no. from the pdf.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 6:46am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/5 "2019-05-24T06:46:35Z")

</div>

> [@Vishnu\_mk](#):
>
> Like if I want to extract Phone no. from the pdf.

Now I understand the question.  
So it's not related to FSCrawler but more a general question on how I can extract a phone number from a text, right?

I mean that FSCrawler is responsible to extract the text from a PDF.  
Once done, you can do whatever with the extracted text.

Here I'd probably try to use an ingest pipeline (which you can define later in FSCrawler with [Elasticsearch settings — FSCrawler 2.10-SNAPSHOT documentation](https://fscrawler.readthedocs.io/en/latest/admin/fs/elasticsearch.html#ingest-node)) to try to apply some regex on your text.

You can try the Grok processor may be: [Grok processor | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html)

If you have further questions, please provide an example of what you tried so far, without using FSCrawler. As I said, that's not FSCrawler's responsability doing that. Like (but for another use case):

```auto
POST _ingest/pipeline/_simulate
{
  "pipeline": {
  "description" : "parse multiple patterns",
  "processors": [
    {
      "grok": {
        "field": "message",
        "patterns": ["%{FAVORITE_DOG:pet}", "%{FAVORITE_CAT:pet}"],
        "pattern_definitions" : {
          "FAVORITE_DOG" : "beagle",
          "FAVORITE_CAT" : "burmese"
        }
      }
    }
  ]
},
"docs":[
  {
    "_source": {
      "message": "I love burmese cats!"
    }
  }
  ]
}

```

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 7:25am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/6 "2019-05-24T07:25:13Z")

</div>

Thank you for you reply . Actually i want to parse my text in resume. For example i want to parse mobile number and create a field mobile no. in the elasticsearch index using FSCrawler. Thank you for your time .

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 7:47am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/7 "2019-05-24T07:47:07Z")

</div>

[https://fscrawler.readthedocs.io/en/latest/admin/fs/elasticsearch.html#ingest-node](https://fscrawler.readthedocs.io/en/latest/admin/fs/elasticsearch.html#ingest-node)) is this used to create field in an index

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 7:51am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/8 "2019-05-24T07:51:42Z")

</div>

```auto
    "docs":[
      {
        "_source": {
          "message": "I love burmese cats!"
        }
      }

```

What is this used for ?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 8:00am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/9 "2019-05-24T08:00:06Z")

</div>

That's a sample document to test an ingest pipeline.

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 11:01am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/10 "2019-05-24T11:01:52Z")

</div>

how can i create a field in the index while using elasticsearch

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 11:56am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/11 "2019-05-24T11:56:22Z")

</div>

I don't understand the question. May be with an example?

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 12:31pm UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/12 "2019-05-24T12:31:20Z")

</div>

Now i am able to create foo field as you suggested using this pipeline  
PUT \_ingest/pipeline/demo1  
{  
"description" : "fscrawler demo",  
"processors" : [  
{  
"set" : {  
"field": "foo",  
"value": "bar"  
}  
}  
]  
}

Can you give me some examples of regex used in pipelines so that i can create mobile no.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 1:20pm UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/13 "2019-05-24T13:20:45Z")

</div>

No I can't.

But you can start with [https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html) and try to make it work.  
If you don't succeed, then share what you did so far as I already explained in details in [Can I parse text in pdf document before sending it to elasticsearch using FSCrawler](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/5).

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 1:29pm UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/14 "2019-05-24T13:29:18Z")

</div>

I am able to parse the name using following pipeline

```
PUT _ingest/pipeline/demo3
{
  "description" : "fscrawler demo3",
  "processors" : [
    {
      
    "grok": { 
        "field": "path.virtual", 
          "patterns": ["\/%{DATA:Name} %{GREEDYDATA:remaining}"] 
        }
 
    }
  ]
}

```

In this pipe line i use grok . But i need regex for parsing mobile no.

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 24, 2019, 1:35pm UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/15 "2019-05-24T13:35:34Z")

</div>

```
KAMALIKA ROY BARMAN

EDUCATION
Indian School of Business – PGP in Management (Intended majors –Marketing & Strategy)
Apr ’18- Present
· Received a merit scholarship of INR 1 Lac (~Top 7% of class) for academic excellence & leadership drive-Young Leaders Programme
· Represented ISB (Top 20/250+ applicants) at NUS, Singapore & Tsinghua University, China in the 1st Asia Innovation Programme
· Developed a business model of an IoT based app for fitness centers in Asia by collaborating with NUS & Tsinghua peers
· National Finalist (Top 30/1800+teams), Mahindra War Room: Devised a go-to-market strategy to resurrect the retro bike- JAWA
· Events Coordinator, Alumni Affairs Council (Selected 2/60 applicants):
· Driving all editions of ‘Shadow an Alum’ initiative across both campuses connecting over 700+ students to alums (YoY growth-20%)
Veermata Jijabai Technological Institute(VJTI), Mumbai| 99.9 percentile in Maharashtra Engineering Entrance Test (~3.2 Lac candidates)
B.Tech in Electronics & Telecommunication ( Top 10 % in class| CGPA 8.06/10)
Jul ‘12-Apr ‘16
· 1st runner-up (2/90+ top international teams), BAJA SAE South Africa 2015: Crafted a business plan to sell ATVs in BRICS nations
· National winner (1/100+ top engineering colleges) of the Maruti Suzuki sponsored go-to-market strategy case-SUPRA SAE India ‘14 - Identified new target segments & proposed a business model to enter the Indian motorsport sector; used primary & secondary research
· Robotics Club: Pioneered 3D printing workshops for 450+ students by building the first ever student-made 3D printer on campus

Internship: Schlumberger Asia Services Ltd.| Wireline Segment
Mumbai|May’15-Jul’15
· Improved divisional efficiency by 30% by designing & developing an analytical tool (Excel-based VBA) to track warehouse inventory Higher Secondary Certificate Exam: Top 1% in state; Received scholarship for higher education (INR 3.75 Lac) from Maharashtra Govt

WORK EXPERIENCE
DELOITTE CONSULTING USI| Business Technology Analyst| System Integration, Technology Consulting
Mumbai|Aug ‘16- Mar’18
Designed, implemented & assessed B2C digital transformation strategies of businesses in US Financial Services & Insurance Sector by optimizing all stages of a product lifecycle – Requirement Analysis, Product Development & Quality Assurance
Key Achievements
· Top 1 % of the 1000+ countrywide analysts as per the latest performance appraisal snapshot released (March 2018)
· Awarded (1/300+) ‘Employee of the year’ title for exemplary contribution to client deliverables & internal firm initiatives
· Youngest team member (1.2years Vs average of 4 years-experience) to win ‘Applause Award’ for accelerating client and business growth
· Won ‘Spot Award’ within 4 months of joining the firm (average ~1 year) for timely detection & analysis of critical project bottlenecks
· 1st project team member (team size ~ 30) to be awarded ‘Performer of the month’ for analytical excellence & digital innovation
Key Engagements (Client-US Financial Services Major)
Digital Strategy Implementation:
· Enabled the 1st on-time successful B2C digital platform release (past success rate- 0/3) of client’s 2 major LOBs worth ~$150M
· Averted potential revenue loss by identifying & eliminating defects causing system failures by designing 75+ business process tests
· Reduced time-to-market by 30% by redesigning the quality assurance modules & executing the user acceptance tests efficiently
· Reduced man-hours by 60% and the scope of human error by creating an automation framework for end-to-end process testing
Process Re-engineering & Account Management:
· Handpicked by senior leaders to expand the scope of work & enhance client relation by creating new risk management frameworks
· Generated new business opportunity for Deloitte ($400K) by applying the P&C insurance rate testing model to client’s other LOBs
· Uncovered potential business operation losses (~$35M) for client by building a model to detect incorrect insurance premium rules
· Accelerated defect detection (~70%) & minimized processing time by redesigning the revenue test model of business worth ~$220M
· Enabled client to build in-house quality assurance capability ($500K/year saving) by training them on automation design & testing
Global Multi-Stakeholder Management & Analytical Excellence (India & USA):
· Modeled digital platform tests of business worth $380M by liaising with multi-cultural teams across 3 external stakeholder entities
· Streamlined & led daily meetings with client & their vendors across 3 geographies improving defect-fix turnaround time by 25%
· Improved project bottleneck time by 30% by identifying gaps in implementation of 300+ business requirements
· Mentored 25+ cross-functional professionals across Deloitte & client’s external vendor team on US govt.’s insurance rating methods
Revenue Management & Project Planning:
· Youngest analyst (1.5 vs Avg. of 4 yrs. exp.) to prepare ‘project hours & resource utilization’ estimate report for senior management - Formulated accurate estimates of client billable hours for 3 sub-engagements (~$500K) factoring external vendor’s deliverables
· Co-authored a White Paper on application of Robotic Process Automation (RPA) testing models in financial services sector
· Led a team of 250+ professionals in the 1st year of joining Deloitte in inter-dept. events; increased employee engagement by 30%

EXTRA-CURRICULARS & PERSONAL INTERESTS
Leadership (Marketing & Outreach)
· Campaign Manager, Teach For India (TFI): Pioneered VJTI & TFI’s collaboration; 1st TFI campaign manager on VJTI college campus
· Increased TFI fellowship applications by 80% by identifying & investing the right students/organizational heads in Teach For India
· Sponsorship Head, SAE VJTI: 1st female member to be elected to the Automotive Club Senate (elected by 350+ members)
· Led a team of 12 to enable auto club’s participation in its first international venture- BAJA SAE South Africa 2015
· Achieved the entire projected budget goal of INR 15L by partnering with 3 PSU ‘Maharatnas’ (ONGC, BHEL and GAIL)
· Trekking -Recognized by the Indian Mountaineering Association & Dept. of Tourism, India for completing 7 Himalayan treks
· Sky-dived from 13,000 ft in Dubai, hiked an active volcano in Bali, scuba-diving & marathon enthusiast (~10km distance runner) Community Service: Taught & mentored 15 Govt. school kids for 1.5 years in collaboration with Deloitte Mumbai office & Teach For India

```

This is my resume and i have many resumes like this but i need to extract mobile no. using regex in the pipeline instead of grok. It would be helpful if you show me regex pattern used in the pipeline

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 24, 2019, 1:51pm UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/16 "2019-05-24T13:51:15Z")

</div>

GROK is based on regex. May be this could help you: [Custom pattern - Telephone number and others](https://discuss.elastic.co/t/custom-pattern-telephone-number-and-others/75712)

---

<div class="post-metadata">

### Author: ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)
#### Post date: [May 26, 2019, 11:24am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/17 "2019-05-26T11:24:57Z")

</div>

Thanks it works 😇 But now the thing is phone no. of all candidates are in different position.

```
For example 
 1st candidate:- My phone no. is 8976635405
2nd candidate: 9874517542 is phone no.

How can i use grok to search for a particular pattern in text
```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 26, 2019, 11:54am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/18 "2019-05-26T11:54:23Z")

</div>

No idea.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 23, 2019, 11:54am UTC](https://discuss.elastic.co/t/can-i-parse-text-in-pdf-document-before-sending-it-to-elasticsearch-using-fscrawler/182564/19 "2019-06-23T11:54:43Z")

</div>

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