Home > database >  How to search for term in query using elasticsearch
How to search for term in query using elasticsearch

Time:09-17

I want to know the proper format or way to search for term in query using elasticsearch in URl method for example

http://localhost:9200/ncar_index/ncar/_search?q=category:الأنظمة&size=100&sort=date:desc&default_operator=AND

CodePudding user response:

Why don't you put your query in the request body?

GET http://localhost:9200/ncar_index/ncar/_search
{
    "size": 10,
    "sort": [
        {"date": "desc"}
    ],
    "query": {
        "match": {
            "category": {
                "query": "الأنظمة",
                "operator": "and"
            }
        }
    }
}

Reference documents
Match Query doc
Limit result with From/Size
Sorting search result

  • Related