0

to get started with elasticsearch and kibana I tried the tutorial. But now I get an error I can't solve on my own.

It's pretty smiliar to this one: elasticsearch bool query combine must with OR

But the solution from Daniel Fackrell doesn't work for me, I am clearly missing something. My Code:

POST shakespeare/scene/_search/
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "play_name": "Antony"
          },
          "bool": {
            "should": [
              {
                "match": {
                  "speaker": "Demetrius"
                }
              },
              {
                "match": {
                  "speaker": "Antony"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

But then I get the following error: "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]"

After searching and looking around for a few hours I hope someone can help me.

I'm using version 5.6.4.

Thanks in advance!

Kind regards Greg

Hatim Stovewala
  • 1,223
  • 7
  • 18
G. H.
  • 1
  • 2

1 Answers1

0

I think you missed a bracket. Check the query below.

POST shakespeare/scene/_search/
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "play_name": "Antony"
          }
        },
        {
          "bool": {
            "should": [
              {
                "match": {
                  "speaker": "Demetrius"
                }
              },
              {
                "match": {
                  "speaker": "Antony"
                }
              }
            ]
          }
        }
      ]
    }
  }
}
Hatim Stovewala
  • 1,223
  • 7
  • 18
swapnil2993
  • 1,024
  • 8
  • 13