Hi,
I'm new to elasticsearch. I'm using version 2.2.0 of Elasticsearch.
I am able to index a .txt file and a .doc file and do a search and get a hit.
However, when I try to index a .docx file, I do not get any hits.
My index is client_index.
My type is documents.
This is my mapping json:
{
"index":"client_index",
"type":"documents",
"body":{
"documents":{
"properties":{
"file":{
"type":"attachment"
}
}
}
}
}
I base64 encode the contents of a .docx file and I add the document to the index with the following json:
{
"index":"client_index",
"type":"documents",
"id":"1",
"body":{
"file": "' . $file_encoded . '"
}
}
This is the response that I get:
Array
(
[_index] => client_index
[_type] => documents
[_id] => 1
[_version] => 1
[_shards] => Array
(
[total] => 2
[successful] => 1
[failed] => 0
)
[created] => 1
)
The content of the .docx file is simply: "This is a small test."
I do a search with the following json:
// Search for text in an attachment
$search_text = "test";
$json = '
{
"index":"client_index",
"type":"documents",
"body":{
"query":{
"query_string":{
"query": "' . $search_text . '"
}
}
}
}
This is the response that I get:
(
[_index] => client_index
[_type] => documents
[_id] => 1
[_version] => 1
[_shards] => Array
(
[total] => 2
[successful] => 1
[failed] => 0
)
[created] => 1
)
I'm searching for the string "test" but I get no hits.
Can someone help me with this please. Thanks.
Mary