Domanda

I'm new in elastica search. Can you help me with creating query ? I need search by name.

GET /site/file/_search

"hits": [
   {
      "_index": "site",
      "_type": "file",
      "_id": "135",
      "_score": 1,
      "_source": {
         "userId": 0,
         "name": "P1030021j.jpg",
         "extension": "jpg",
         "size": 1256
      }
   }
]

Thanks,

È stato utile?

Soluzione

I find solution for my problem:

{
    "fuzzy_like_this" : {
        "fields" : ["name"],
        "like_text" : "Search string",
        "max_query_terms" : 12
    }
}

Altri suggerimenti

Search by URL:

GET /site/file/_search?q=name:P1030021j.jpg

Search By Restful API

GET /site/file/_search 
{   
    "query" : {
        "query_string" : {
             "query" : "name:P1030021j.jpg"
         }
     }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top