A
A
Alexey Bespalov2016-08-26 15:28:57
elasticsearch
Alexey Bespalov, 2016-08-26 15:28:57

What is the search query in elasticsearch at different levels?

For view index

{
  "posts": {
    "mappings": {
      "activity": {
        "properties": {
          "categories": {
            "properties": {
              "description": {
                "type": "string",
                "analyzer": "russian"
              },
              "name": {
                "type": "string",
                "analyzer": "russian"
              }
            }
          },
          "tags": {
            "type": "nested",
            "properties": {
              "name": {
                "type": "string",
                "analyzer": "russian"
              }
            }
          },
          "description": {
            "type": "string",
            "analyzer": "russian"
          },
          "title": {
            "type": "string",
            "analyzer": "russian"
          }
        }
      }
    }
  }
}

you need to make a full-text search request for all the fields that are. That is, by `title`, `description`, `tags.name`, `categories.name` and `categories.description`. Is it even possible to do this?
Saw in docks only requests separately on levels.
I will be very grateful for your help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2016-08-26
@leahch

Yes you can - https://www.elastic.co/guide/en/elasticsearch/refe...
Just put "_all". But if the index is gigantic, then there may be performance issues.

M
MintTea, 2016-08-27
@MintTea

If you need exactly for all available fields, they already answered above about _all.
If the fields are still enumerable, a multi match query is better .

curl -XGET 'http://elasticsearch:9200/_search' -d '{
    "query": {
        "multi_match": {
            "query": "My search query",
            "fields": [
                "title",
                "description",
                "tags.name",
                "categories.name",
                "categories.description"
            ]
        }
    }
}'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question