MISP / MISP/PyMISP

complex_query using and_parameters does not return expected result

Open
#719 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S: needs more info T: support
Dominant language
Python
Stars
491
Forks
290
Avg merge
2d 8h
Merged PRs (30d)
3

Description

Hi,

I have tried several queries with two tags.
In separate queries (search_index with one tag) the search with the first tag returns 321 events and with the second tag 27 events.

I would assume AND-ing these together into one complex_query as below returns at most 27 events, but it returns 321 events:

tags = ['iss-compliance:true', 'source:tls_stats']
complex_query = misp.build_complex_query(
    and_parameters=tags
)
search_params = {
    'tags': complex_query,
}
filtered_events = misp.search_index(**search_params)

What am I missing?

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PyMISP's build_complex_query and search_index entry points, then compare the generated tags query with the MISP REST API's expected filtering semantics. Reproduce the two individual searches and the combined query using the issue's tag values; done means the combined search returns results consistent with AND semantics or the behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.