Search problem within the attachment type field

Hello,
First of all, let me tell you that i am totally new on elasticsearch concept and trying to learn it in details.
Now, i am having a problem about searching on an attachment field (I can query on other fields)

This is my mapping:
{
"files": {
"properties": {
"file": {
"type": "attachment",
"fields": {
"content": {
"type": "string",
"term_vector":"with_positions_offsets",
"store": true
},
"name" : { "type" : "string" }
}
}
}
}
}

This is the result when i query with the record id (http://localhost:9200/filesystem/files/10):
{
"_index": "filesystem",
"_type": "files",
"_id": "10",
"_version": 1,
"found": true,
"_source": {
"content": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}
}

Encoded string contains "ipsum" word so i should be able to get a result when i query "ipsum".

I could not get any result with below one through REST client:
POST http://localhost:9200/filesystem/files/_search
{
"query": {
"query_string": {
"query": "ipsum"
}}}

can you pls help me how can i search within the attachment type field.
Thanks in advance

Your field name should be file. Not content.

Hello David,
thanks for your reply, it solved one part of my problem, i appreciate it.
Now i have another problem about highlighting the result. can you pls help me about this too?

My mapping:

{
"files": {
"properties": {
"file": {
"type": "attachment",
"fields": {
"content": {
"type": "string",
"term_vector":"with_positions_offsets",
"store": true
},
"name" : { "type" : "string" }
}
}
}
}
}

My Insert Document Request:

{
"file" : "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}

My Query Request:

{
"query": {
"query_string": {
"query": "ipsum"
}
},
"highlight" : {
"fields" : {
"file" : {}
}
}
}

The Search Result:

{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.095891505,
"hits": [
{
"_index": "filesystem",
"_type": "files",
"_id": "11",
"_score": 0.095891505,
"_source": {
"file": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}
}
]
}
}

As you can see in the response, there is no hightlight information in the response. What is my mistake, pls kindly advice.
Thanks

Have a look at https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-attachments-highlighting.html

Highlight file.content

when i query with "match", i can get the highlighted result. however when i use the "query_string", i can not get the highlighted result. what is the difference between them. I am asking this in order to learn it in details, thanks for your time .

this works for highlighting:

request:
{
"query": {
"match": {
"file.content": "ipsum"
}
},
"highlight" : {
"fields" : {
"file.content" : {}
}
}
}
response:
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.13424811,
"hits": [
{
"_index": "filesystem",
"_type": "files",
"_id": "11",
"_score": 0.13424811,
"_source": {
"file": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
},
"highlight": {
"file.content": [
"Lorem ipsum dolor sit amet\n\n"
]
}
}
]
}
}

this does not works for highlighting:

request:
{
"query": {
"query_string": {
"query": "ipsum"
}
},
"highlight" : {
"fields" : {
"file.content" : {}
}
}
}
response:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.095891505,
"hits": [
{
"_index": "filesystem",
"_type": "files",
"_id": "11",
"_score": 0.095891505,
"_source": {
"file": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}
}
]
}
}

query_string query uses _all field. That's the reason.

Hello David,
Now, i have another problem, i have indexed a word document (docx) which is a CV and mostly prepared with tables in the document, but i am not able to find results with basic searchs.
Is there a restriction about the tables in elastic search? do you have any idea about my problem?
thank you

This is the screenshot of the document which i have indexed.

Well. I don't know. It depends on what Tika can do as this plugin only exposes Tika.