Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IpFieldMapper should use IndexOrDocValuesQuery where possible #11144

Closed
harshavamsi opened this issue Nov 9, 2023 · 6 comments · Fixed by #11508
Closed

IpFieldMapper should use IndexOrDocValuesQuery where possible #11144

harshavamsi opened this issue Nov 9, 2023 · 6 comments · Fixed by #11508
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request Search:Performance v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@harshavamsi
Copy link
Contributor

harshavamsi commented Nov 9, 2023

Is your feature request related to a problem? Please describe.
While going through the IpFieldMapper class and looking through IpFieldMapperType I noticed that the termQuery, termsQuery, and rangeQuery all use underlying lucene index queries. The documentation also incorrectly points to the fact that IP address do not have doc_values enabled by default. This is incorrect, ref:

private final Parameter<Boolean> hasDocValues = Parameter.docValuesParam(m -> toType(m).hasDocValues, true);

Describe the solution you'd like
Wrap all three queries in IndexOrDocValuesQuery and add checks to ensure that we return the index query if the field is only indexed and doc_values query if we only have doc_values enabled.

Describe alternatives you've considered
Alternative is to leave this as is. But there is potentially a lot of performance improvement to be had. Consider a query that looks like

{
  query: {
  "range":{
  "timestamp: {
      "from" :xyz,
       "to": xyz
    }
   },
"terms": {
"ipaddress" :["0.0.0.0", "1.1.1.1"]
}
}
}

We could let the range on the timestamp drive the query and use the doc_values to match the documents for the terms in the ipaddress.

Additional context
#7057

@hdhalter
Copy link

Hi @harshavamsi , will this require documentation for 2.12? If so, can you please create a doc issue, let me know who will be responsible for the doc PR, and add this to the unified tracker project? Thank you!

@getsaurabh02 getsaurabh02 moved this from In Progress to In-Review in Performance Roadmap Jan 10, 2024
@kiranprakash154
Copy link
Contributor

Hi, are we on track for this to be released in 2.12 ?

@reta reta added the v3.0.0 Issues and PRs related to version 3.0.0 label Jan 19, 2024
@getsaurabh02
Copy link
Member

@reta Is there are reason we should move this to 3.0? Given the PR is already out by @vamshin we might be able to close it in before 2.12?

@reta
Copy link
Collaborator

reta commented Jan 23, 2024

@reta Is there are reason we should move this to 3.0? Given the PR is already out by @vamshin we might be able to close it in before 2.12?

Yeah, I think so, the issue is tagged to 2.12.0 (and 3.0.0 surely) :)

@hdhalter
Copy link

@reta Does this require documentation for 2.12?

@reta
Copy link
Collaborator

reta commented Jan 23, 2024

@reta Does this require documentation for 2.12?

I believe there are no user facing changes here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Search:Performance v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
Status: 2.12.0 (Launched)
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants