# I cant index microsoft office files and pdf in elisticsearch

**URL:** https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377
**Category:** Elasticsearch
**Created:** [February 25, 2018, 12:24pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377 "2018-02-25T12:24:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sara2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sara2/32/28152_2.png) [@sara2](https://discuss.elastic.co/u/sara2)
#### Post date: [February 25, 2018, 12:24pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377/1 "2018-02-25T12:24:43Z")

</div>

hello ,  
i use elisticsearch 2.0.0 and i try to index and search for pdf files or word files but it always failed because content inserted on it like encoded text and when use file\_get\_content it also failed  
and i search and try to use tika apache but i cant install plugin for mapper and i dont know how integrated it i'm new in elisticsearch and  
is the elisticsearch support searching in word files or pdf file ?

---

<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: [February 25, 2018, 2:21pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377/2 "2018-02-25T14:21:32Z")

</div>

Have a look at:

- [https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/ingest-attachment.html](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/ingest-attachment.html)
- [https://github.com/dadoonet/fscrawler](https://github.com/dadoonet/fscrawler)

If you are looking at something more OOTB look at [https://swiftype.com/](https://swiftype.com/)

---

<div class="post-metadata">

### Author: ![sara2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sara2/32/28152_2.png) [@sara2](https://discuss.elastic.co/u/sara2)
#### Post date: [February 25, 2018, 2:36pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377/3 "2018-02-25T14:36:37Z")

</div>

but ingest-attachment not available on elisticsearch 2.0.0

i use this plugin elasticsearch-mapper-attachments and try to index document by this code

```
   $content = base64_encode(file_get_contents($doc_src));

```

//Indexing by mapping  
$json = '{  
"attachment" : {  
"\_content\_type" : "application/pdf",  
"\_name" : "'.$doc\_src.'",  
"\_content" : "'.$content.'"  
}  
}';

```
    $params = array();
    $params['index'] = 'documents';
    $params['type'] = 'attachment';
    $params['id'] = '17';
    $params['body'] = $json;

      $response= $this->elasticsearch->client->index($params);
  print_r($response);

```

and it index the document with encoding document but when i search

```
 $params['index'] = 'documents';
    $params['type'] = 'attachment';
    $params2['body']['query']['match']['file.content'] = 'Text';
    $response= $this->elasticsearch-> client->search($params2);
    print_r($response);

```

there is now result it always release empty array

---

<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: [February 25, 2018, 4:39pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377/4 "2018-02-25T16:39:23Z")

</div>

> but ingest-attachment not available on elisticsearch 2.0.0

That's true. I'd suggest to upgrade to 5.6 or 6.2.  
At the very least you should upgrade to latest 2.x. 2.0.0 is so old.

`mapper-attachments` plugin has been removed in 6.x so I'd really recommend not using it.

---

<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: [March 25, 2018, 4:40pm UTC](https://discuss.elastic.co/t/i-cant-index-microsoft-office-files-and-pdf-in-elisticsearch/121377/5 "2018-03-25T16:40:25Z")

</div>

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