Need help with mapping


(NLS) #1

I have some fields like modelName that can have a dash or pipe
(example: Owner_at_1-1tenth_Boxes|1.1").

I want the user to be able to search for this modelName via "Owner*" or
"Owner_at_1*" or "Owner_at_1-1*" and get this document.

But by default it splits the word on the hypen and pipe character so the
searches I am doing with query_string don't give me the correct results.

I searched around and think I need to set the _mapping to use
index_analyzer word-delimiter with generate_word_parts = true,
catenate_words = true, preserve_original = true but don;t know how to set
that command. What search analyzer should I use, I was thinking keyword.

I think I need to set _mapping to
{
"spatial_metadata":
{
"properties":
{
"alias":
{
"type": "string",
"index_analyzer": "word-delimiter",
"search_analyzer": "keyword"
},
"modelName":
{
"type": "string",
"index_analyzer": "word-delimiter",
"search_analyzer": "keyword"
}
}
}
}

But where does the generate_word_parts = true, catenate_words = true,
preserve_original = true part go?

I just want to be able to do queries with wildcards and this field to be
one term. But when I set keyword or not_analyzer then I cannot do a
query_string with a wildcard.

--


(system) #2