Multi Query and Querying with Spaces

Hello,

I'm setting various visualizations to filter on Kibana and I need to be able to search by specific words in a text description. Let's say I have a paragraph description and I want to populate results when "Blue" or "Red" come up or "Puppy Dog" comes up.

Here is what I have so far...

  1. The below query results in any entry with red or blue in the selected field. Is this the most efficient way to write this out?

  2. How would I search for "Puppy Dog" since it has a space, without searching for "puppy" and "dog" separately?


{
  "query": {
    "query_string": {
      "default_field": "Paragraph",
      "query": "*Red* and *Blue*"
    }
  }
}

Hey! Have you tried something like:

{
  "query": {
    "query_string": {
      "default_field": "Paragraph",
      "query": "(*Red*) OR (Puppy Dog) OR (*Blue*)"
    }
  }
}

Check the documentation here Query string query | Elasticsearch Guide [8.5] | Elastic

Hey, thanks for the reply. I tried your suggestion and it did not work, but then it gave me an idea.

Putting (Puppy AND Dog) OR (Blue) returned both entries. Seems to work just fine, I'll play around more and give feedback if anything else changes.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.