I am new to elasticsearch, so I may not be constructing the mapping in a 
correct way. But, my mapping looks as follows:

/myindex/messages/_mapping

{

    “messages“: {

        "properties": {

            "author": {

                "type": "String"

            },

            “pipe_id": {

                "type": "String"

            },

            "files": {                

                    "type": "nested",

                    "properties": {

                        "file" : {

                            "type": "attachment", 

                            "path": "full", 

                            "fields":

                            {

                            "file_author": {

                                "type": "String"

                            },

                            "file_id": {

                                "type": "String"

                            },

                            "file_mimetype": {

                                "type": "String"

                            },

                            "filename": {

                                "type": "String"

                            },

                            "content" : { 
"term_vector":"with_positions_offsets", "store":"yes", "type": "String" }

                            }

                        }

                    }

            },

            "tags": {

                "properties": {

                    "tag_id": {

                        "type": "String"

                    },

                    "tag_name": {

                        "type": "String"

                    }

                },

                "type": "nested"

            },

            "email": {

                "type": "String"

            },

            “message_description": {

                "type": "String"

            },

            “message_title": {

                "type": "String"

            }

        }

    }

}


Now I have indexed the document and been able to search correctly on the 
attachments. But the highlighting on the "content" does not work. My query 
is as follows:

POST /myindex/messages/_search

{

    "query" : {

    "query_string" : {

      "query" : "music"

    }

  },

  "highlight": {

      "fields": {

          "files.file.content" : {}

      }

  } 

}

It matches the term "music" in my file and displays the base 64 encoded 
string but there is no highlight field. Please suggest if my mapping is 
correct and why am I not getting the highlighted result?

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ff20aab1-0502-469d-9985-f69e271d875a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to