Query: Field A contains Field B`s value

Hello,
i unsuccessfully try to query a document with his field a contains (not is equal) the value of field b. then negate this. can anybody help?

here an example to clarify:
fieldA:"test-MATCH", fieldB:"MATCH" -> no match
fieldA:"MATCH-test", fieldB:"MATCH" -> no match
fieldA:"test-test", fieldB:"MATCH" -> match
fieldA:"MATCH",fieldB"MATCH" -> no match

KQL won't allow you to do this. You can replicate this by using a scripted field: Scripted fields | Kibana Guide [7.11] | Elastic

The script should do the contains check and return the result (true/false).

Then you can filter by this scripted field in Discover or Visualize.

1 Like

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