Hello,
I'm new to Elasticsearch. I'm looking to write a plugin that at search time, it only looks at some specific sub-fields based on the search query. For example, with the following example I only want to get "Cat Fred" as the result by only looking at text.Cat subfield. I cloned the source code and implemented this behavior by changing the fromXContent method in MultiMatchQueryBuilder.java. Can someone help me how I can override this method somehow in a plugin?
Example:
PUT my_index
{
"mappings": {
"properties": {
"text": {
"type": "text",
"fields": {
"Dog": {
"type": "text",
"analyzer": "english"
},
"Cat": {
"type": "text",
"analyzer": "english"
}
}
}
}
}
}
PUT my_index/_doc/1
{
"text" : "Cat Fred"
}
PUT my_index/_doc/2
{
"text" : "Dog Fred"
}
GET my_index/_search
{
"query": {
"multi_match": {
"query": "Fred",
}
}
}