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

Treating document IDs as numbers in /search responses #2107

Closed
8 tasks done
Nick-S-2018 opened this issue Apr 29, 2024 · 4 comments
Closed
8 tasks done

Treating document IDs as numbers in /search responses #2107

Nick-S-2018 opened this issue Apr 29, 2024 · 4 comments
Assignees
Labels
est::size_S rel::6.3.0 Released in 6.3.0

Comments

@Nick-S-2018
Copy link
Collaborator

Nick-S-2018 commented Apr 29, 2024

Proposal:

Now, we pass document IDs as strings in HTTP responses from the /search endpoint . E.g., here is an example from our Manual:


POST /search
-d
'{
    "index" : "hn_small",
    "query":
    {
        "match":
        {
            "*" : "find joe"
        }
    },
    "_source": ["story_author","comment_author"],
    "limit": 1
}'


{
   "took" : 3,
   "timed_out" : false,
   "hits" : {
      "hits" : [
         {
            "_id" : "668018",
            "_score" : 3579,
            "_source" : {
               "story_author" : "IgorPartola",
               "comment_author" : "joe_the_user"
            }
         }
      ],
      "total" : 88063,
      "total_relation" : "eq"
   }
}


For the sake of consistency, we should pass IDs as numbers instead, just like we do for responses from other HTTP API endpoints. E.g., for the /replace we have:

POST /replace
-H "Content-Type: application/x-ndjson" -d '
{
  "index":"products",
  "id":1,
  "doc":
  {
    "title":"product one",
    "price":10
  }
}
'
{
  "_index":"products",
  "_id":1,
  "created":false,
  "result":"updated",
  "status":200
}

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Task estimated
  • Specification created, reviewed and approved
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation proofread
  • Changelog updated
  • OpenAPI YAML updated and issue created to rebuild clients
@tomatolog
Copy link
Contributor

fixed at the 0f2ecdf /search endpoint to output integers instead of string for id property

@sanikolaev
Copy link
Collaborator

@Nick-S-2018 pls update it in the docs

@sanikolaev sanikolaev reopened this May 2, 2024
@sanikolaev sanikolaev assigned Nick-S-2018 and unassigned tomatolog May 2, 2024
@sanikolaev
Copy link
Collaborator

@Nick-S-2018 pls also update the openapi yaml if required

@Nick-S-2018
Copy link
Collaborator Author

Updated docs. Openapi yaml doesn't need an update here.

@sanikolaev sanikolaev added the rel::upcoming Upcoming release label May 8, 2024
@sanikolaev sanikolaev added rel::6.3.0 Released in 6.3.0 and removed rel::upcoming Upcoming release labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
est::size_S rel::6.3.0 Released in 6.3.0
Projects
None yet
Development

No branches or pull requests

3 participants