More_Like_This per_field_analyzer

Documentation says that you can use per_field_analyzer's in an MLT query. Using 1.7.1

docs

The list of documents to find documents like it. The syntax to specify documents is similar to the one used by the Multi GET API. The text is fetched from fields unless overridden in each document request. The text is analyzed by the analyzer at the field, but could also be overridden. The syntax to override the analyzer at the field follows a similar syntax to the per_field_analyzer parameter of the Term Vectors API.

I can't figure out how, "similar" isn't working. I tried like below but it returns ...QueryParsingException[[.indexname] [mlt] query does not support [Email]]; },

{
"query": {
"more_like_this": {
"fields": [
"Email^5",
"Name",
],
"per_field_analyzer": {
"Email": "not_analyzed"
},
"docs": [
{
"_index": "jdbc",
"_type": "MyType",
"_id": "LONGIDSTRINGHERE123"
}
],
"min_term_freq": 1,
"max_query_terms": 5,
"stop_words": [
"Install"
]
}
},
"from": 0,
"size": 250,
"aggs": {
"top_types": {
"terms": {
"field": "_type"
},
"aggs": {
"top_type_hits": {
"top_hits": {
"size": 25
}
}
}
}
}
}

i also tried "per_field_analyzer": [{
"Email": "not_analyzed"
}],

but it says same error with per_field_analyzer in there.

I think the per_field_analyzer setting belongs into the entries in the docs array. Have you tried that?

1 Like

That was it!

TYVM