Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

highlighting documentation #54

@rpedela

Description

@rpedela

I think adding a section to the README about highlighting with an example would be great. It took me awhile to figure out the correct syntax. Based on threads on the mailing list and stackoverflow, I suspect the missing piece of information is that you need to use the field's name when setting the type of highlighter which isn't obvious at least for me. At least that is true for version 1.9.0 of the plugin.

From https://gist.github.com/dadoonet/3907010

curl -X PUT "${host}/test/attachment/_mapping" -d '{
    "attachment" : {
        "properties" : {
            "file" : {
                "type" : "attachment",
                "fields" : {
                    "title" : { "store" : "yes" },
                    "file" : { "term_vector":"with_positions_offsets", "store":"yes" }
                }
            }
        }
    }
}'

Since file is such a generic name, I thought that meant I should do the following:

curl -X PUT "${host}/test/my_type/_mapping" -d '{
    "my_type" : {
        "properties" : {
            "my_html_file" : {
                "type" : "attachment",
                "fields" : {
                    "title" : { "store" : "yes" },
                    "file" : { "term_vector":"with_positions_offsets", "store":"yes" }
                }
            }
        }
    }
}'

Instead this worked:

curl -X PUT "${host}/test/my_type/_mapping" -d '{
    "my_type" : {
        "properties" : {
            "my_html_file" : {
                "type" : "attachment",
                "fields" : {
                    "title" : { "store" : "yes" },
                    "my_html_file" : { "term_vector":"with_positions_offsets", "store":"yes" }
                }
            }
        }
    }
}'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions