How can we use multiple analyzer to the same field or all field?


(Vinothkumar) #1

Hi

We want to use multiple analyzer to the index in every individual fields . Mainly these two analyzer "Tern analyzer","Synonym analyzer"

And to all fields I need to apply both the analyzer

First It has to go with tern analyzer and if spelling mistakes are there and it has to correct and apply the synonym analyzer then fetch all the related results.

Example

Sample contents:

{
"_id":1,
"content":"piece of test here."
},{
"_id":2,
"content":"piece of analysis here."
},{
"_id":3,
"content":"piece of exam patterns are here."
},{
"_id":4,
"content":"Empty content."
}

And My query will be consist both of the below

Query type 1 :

{
"query": {
"match": {
"_all": {
"query": "test",
"fuzziness": "AUTO",
"operator": "and"
}
}
}

Expected Response for this query --> It has to give following id as response from the sample content .
"_id":1,
"content":"piece of test here."
},{
"_id":2,
"content":"piece of analysis here."
},{
"_id":3,
"content":"piece of exam patterns are here."
}

Logic behind this :
synonyms of test applied to the search results and it returns all the test related synonms document.

Query Type 2 :

{
"query": {
"match": {
"_all": {
"query": "tset",
"fuzziness": "AUTO",
"operator": "and"
}
}
}

Expected Response for this query --> It has to give following id as response from the sample content .
"_id":1,
"content":"piece of test here."
},{
"_id":2,
"content":"piece of analysis here."
},{
"_id":3,
"content":"piece of exam patterns are here."
}

Logic behind this :
Ngram anayazer need to apply to the query and query string spelling has to be corrected then synonyms anlayzer need to apply and fetch the results.
In simple words we can say that it has to use both of the analyzer for all the fields.

How can I achieve this in Elastic Search?
Can anyone suggest me to the direction.

Thank you
Vinothkumar K


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.