Quantcast
Channel: Библиотека знаний
Viewing all articles
Browse latest Browse all 1318

How to search for tags?

$
0
0

How to search for tags?

{
 "query": {
    "bool": {
      "should": [
        {
          "match": {
            "keyword": {
              "query": "abstract, background"
            }
          }
        }
      ]
    }
  }
}  

Mapping

PUT /freevects
{
  "mappings": {
    "photos": {
      "properties": {
        "title": {
          "type": "text",
          "boost": 1.9,
          "analyzer": "standard"
        },
        "keyword": {
          "type": "keyword",
          "boost": 1.4
        },
        "category": {
          "type": "keyword",
          "index": false
        },
        "quality": {
          "type": "short",
          "index": false,
          "boost": 1.1
        },
        "downloads": {
          "type": "integer",
          "index": false,
          "boost": 1.1
        },
        "likes": {
          "type": "integer",
          "index": false,
          "boost": 1
        },
        "filename": {
          "type": "keyword",
          "index": false
        },
        "type": {
          "type": "keyword",
          "index": false
        },
        "free": {
          "type": "short",
          "index": false
        },
        "created": {
          "type": "date",
          "index": false
        }
      }
    }
  }
}

Query

{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "keyword": "abstract"
          }
        },
        {
          "match": {
            "keyword": "background"
          }
        }
      ]
    }
  }
}

Viewing all articles
Browse latest Browse all 1318