Skip to content

Conversation

@Kiriakos1998
Copy link
Contributor

At the moment rank_feature does not support null_value functionality. So documents, with null as their value for rank_feature fields, can not be indexed and so they can not be retrieved when searching. This PR implements this functionality. So if the null_value is specified in a rank_feature field, all documents with null as their value for this rank_feature will use during indexing the value specified in null_value.

Closes(#95149)

@elasticsearchmachine elasticsearchmachine added v8.9.0 needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team labels May 3, 2023
@Kiriakos1998 Kiriakos1998 marked this pull request as draft May 3, 2023 22:10
@Kiriakos1998 Kiriakos1998 marked this pull request as ready for review May 3, 2023 22:11
@dliappis dliappis added :Search Relevance/Ranking Scoring, rescoring, rank evaluation. and removed needs:triage Requires assignment of a team area label labels May 8, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label May 8, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@mayya-sharipova mayya-sharipova self-assigned this May 19, 2023
@mayya-sharipova mayya-sharipova self-requested a review May 19, 2023 19:37
@mayya-sharipova
Copy link
Contributor

@elasticmachine test this please

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kiriakos1998 Thanks for your contributions. Good progress so far.
I've left the initial comments. Can you please also fix formatting by running ./gradlew :modules:mapper-extras:spotlessApply

@Kiriakos1998 Kiriakos1998 force-pushed the null_value_rank_feature/95149 branch from f89f2ac to 937fbeb Compare May 20, 2023 00:13
@Kiriakos1998
Copy link
Contributor Author

@Kiriakos1998 Thanks for your contributions. I've left the initial comments. Can you please also fix formatting by running ./gradlew :modules:mapper-extras:spotlessApply

@mayya-sharipova Thanks for reviewing this PR. spotlessApply also done.

public void testNegativeScoreImpact() throws Exception {
DocumentMapper mapper = createDocumentMapper(
fieldMapping(b -> b.field("type", "rank_feature").field("positive_score_impact", false))
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests look very complex and unnecessary to my mind. Let's instead of them use something simple, similar to KeywordFieldMapperTests::testNullValue()

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kiriakos1998 Thanks for making progress on this. The main code looks very good to me (except correcting error message). Let's also adjust the tests to standard we have in the team.

@mayya-sharipova
Copy link
Contributor

@elasticsearchmachine test this please

@Kiriakos1998
Copy link
Contributor Author

@elasticsearchmachine test this please

Hello, I think I need to do one more commit because in the RankFeatureFieldMapperTests.java file Intellij replaced explicit import with wild *.

@mayya-sharipova
Copy link
Contributor

@elasticsearchmachine test this please

Hello, I think I need to do one more commit because in the RankFeatureFieldMapperTests.java file Intellij replaced explicit import with wild *.

Thank you. Before submitting your commits, please run locally ./gradlew precommit and make sure it passes.

@Kiriakos1998
Copy link
Contributor Author

@elasticsearchmachine test this please

Hello, I think I need to do one more commit because in the RankFeatureFieldMapperTests.java file Intellij replaced explicit import with wild *.

Thank you. Before submitting your commits, please run locally ./gradlew precommit and make sure it passes.

Done


---
"Non positive null_vallue":

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like setup section is not relevant for this test, as we are not doing any request agains test1 index. Should we get rid of setup section all togehter, and instead have two tests:

  1. "Non positive null_vallue"
  2. "Search rank_feature with and without no null_value", where we create and add docs to test1 and do 2 searches against it.
    Each of this test will have its own skip section.
}

public void testNullValue() throws IOException {
DocumentMapper mapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, Lines 149-151 are not relevant for rank_feature field, which we need to explicitly define in mappings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I delete those lines or replace them with these lines of code?
DocumentMapper mapper = createDocumentMapper(fieldMapping(b -> b.field("type", "rank_feature"))); ParsedDocument doc = mapper.parse(source(b -> b.nullField("field"))); assertThat(doc.rootDoc().getFields("_feature"), empty());

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kiriakos1998 Thanks for iterating. The code looks perfect! We just need to do small changes in tests, and this PR will be ready!

@Kiriakos1998
Copy link
Contributor Author

@Kiriakos1998 Thanks for iterating. The code looks perfect! We just need to do small changes in tests, and this PR will be ready!

@mayya-sharipova Thanks for the feedback. I have pushed the changes for the yaml rest test and the unit test.

@mayya-sharipova
Copy link
Contributor

@elasticsearchmachine test this please

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kiriakos1998 Thanks for your work. PR looks good to me! Merged for Elasticsearch v.8.9.

@mayya-sharipova mayya-sharipova merged commit e44edce into elastic:main May 23, 2023
mayya-sharipova added a commit to mayya-sharipova/elasticsearch that referenced this pull request May 26, 2023
Correct and add more tests for adding null_value parameter for the rank_feature field. Relates to elastic#95811, closes elastic#95149
@Kiriakos1998 Kiriakos1998 deleted the null_value_rank_feature/95149 branch May 26, 2023 22:29
mayya-sharipova added a commit that referenced this pull request May 30, 2023
Correct and add more tests for adding null_value parameter for the rank_feature field. Relates to #95811, closes #95149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team :Search Relevance/Ranking Scoring, rescoring, rank evaluation. Team:Search Meta label for search team v8.9.0

5 participants