# How to do elastic search for selected pdf file

**URL:** https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980
**Category:** Elasticsearch
**Created:** [January 21, 2019, 6:11am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980 "2019-01-21T06:11:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Niranjan\_Sourabh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niranjan_sourabh/32/40001_2.png) [@Niranjan\_Sourabh](https://discuss.elastic.co/u/Niranjan_Sourabh)
#### Post date: [January 21, 2019, 6:11am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/1 "2019-01-21T06:11:48Z")

</div>

I have requirement that to do elastic search for particular word/text/sentences in selected pdf file not for all present in specific folder.

using elasticsearch fs crawler and kibana .

Any idea guyz???????

---

<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: [January 21, 2019, 8:38am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/2 "2019-01-21T08:38:24Z")

</div>

What did you try so far?  
What is not working ?

---

<div class="post-metadata">

### Author: ![Niranjan\_Sourabh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niranjan_sourabh/32/40001_2.png) [@Niranjan\_Sourabh](https://discuss.elastic.co/u/Niranjan_Sourabh)
#### Post date: [January 21, 2019, 11:05am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/3 "2019-01-21T11:05:20Z")

</div>

currently process is like that pdf files need to put in folder and that path gave to fscrawler but its searching searched text in all file.

My requirement is that in UI it will show the list of all files and we have to select the 2 or 3 files or how many you want. then search for particular word/sentence/text in that particular selected files.

I am new in Elastic search so something is there that we can send the selected files in request so that output will come from that files only.

so i am not getting an idea or i didnt find any thing over google search , how to do /

---

<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: [January 22, 2019, 10:56am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/4 "2019-01-22T10:56:42Z")

</div>

I think that what you are describing and your question is more related to the UI part than the server side part.

But anyway, let say you have indexed all your files with FSCrawler in elasticsearch. So you have documents like:

```auto
{
  "_index" : "fscrawler_doc",
  "_type" : "_doc",
  "_id" : "dd18bf3a8ea2a3e53e2661c7fb53534",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "content" : "This file contains some words.\n",
    "meta" : {
      "raw" : {
        "X-Parsed-By" : "org.apache.tika.parser.DefaultParser",
        "Content-Encoding" : "ISO-8859-1",
        "Content-Type" : "text/plain; charset=ISO-8859-1"
      }
    },
    "file" : {
      "extension" : "txt",
      "content_type" : "text/plain; charset=ISO-8859-1",
      "indexing_date" : "2017-01-04T21:01:08.043",
      "filename" : "test.txt"
    },
    "path" : {
      "virtual" : "/test.txt",
      "real" : "/path/to/test.txt"
    }
  }
}

```

You can first run a

```auto
GET fscrawler_doc/_search

```

To retrieve the list of documents (only the first 10 documents though). You can also run:

```auto
GET fscrawler_doc/_search?size=9999

```

To have a list of 9999 documents for example.

Then let say you select 3 documents from the UI. And you want to search within those documents only, you can run something like:

```auto
GET fscrawler_doc/_search
{
  "query": {
    "bool" : {
      "must" : {
        "match" : { "content" : "foo" }
      },
      "filter": {
        "ids" : { "values" : ["dd18bf3a8ea2a3e53e2661c7fb53534", "id2", "id3"] }
      }
    }
  }
}

```

That way you will search for `foo` as a text only in 3 documents.

---

<div class="post-metadata">

### Author: ![Niranjan\_Sourabh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niranjan_sourabh/32/40001_2.png) [@Niranjan\_Sourabh](https://discuss.elastic.co/u/Niranjan_Sourabh)
#### Post date: [January 23, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/5 "2019-01-23T09:45:16Z")

</div>

Thank you so much . Thats idea i was looking for.  
i will try 🙂

---

<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: [February 20, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-to-do-elastic-search-for-selected-pdf-file/164980/6 "2019-02-20T09:45:17Z")

</div>

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