Incoporating search with Boolean Queries?

Hi,
I am currently using the following query -

{
    "_source": [
        "title",
        "bench",
        "id_",
        "court",
        "date",
        "content"
    ],
    "size": 15,
    "from": 0,
    "query": {
        "bool": {
            "must": [
                {
                    "multi_match": {
                        "query": "the",
                        "fields": [
                            
                            "content"
                        ], "operator": "and"
                    }
                },
               
            ],
            "should": {
                "multi_match": {
                    "query": "the",
                    "fields": [
                        "content.standard^2"
                    ], "operator": "and"
                }
            }
        }
    }
    ,
    "highlight": {
        "pre_tags": [
            "<tag1>"
        ],
        "post_tags": [
            "</tag1>"
        ],
        "fields": {
            "content": {}
        },
        "fragment_size": 100
    }
}

With the following mapping

{
    "courts_2": {
        "mappings": {
            "properties": {
                "author": {
                    "type": "text",
                    "analyzer": "my_analyzer"
                },
                "bench": {
                    "type": "text",
                    "analyzer": "my_analyzer"
                },
                "citation": {
                    "type": "text"
                },
                "content": {
                    "type": "text",
                    "fields": {
                        "standard": {
                            "type": "text"
                        }
                    },
                    "analyzer": "my_analyzer"
                },
                "court": {
                    "type": "text"
                },
                "date": {
                    "type": "text"
                },
                "id_": {
                    "type": "text"
                },
                "title": {
                    "type": "text",
                    "fields": {
                        "standard": {
                            "type": "text"
                        }
                    },
                    "analyzer": "my_analyzer"
                },
                "verdict": {
                    "type": "text"
                }
            }
        }
    }
}

My analyzer is a metaphone analyzer.
Here is my Aim. I want the exact matches ( standard ) to appear first, followed by phonetic ones. I am able to achieve that with the code. I am pretty sure that there is (are) some unwanted logic in this and would deeply appriciate if someone can point to it.

Additionally what I would like to incorporate is a search logic where a user can enter a search like

Real Madrid AND Barcelona OR Manchester United. 

Here I want all documents that contain Real Madrid and either Barcelona/Man Utd/ How do I achieve with the current query I have in place (with modifications)?

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