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

Get the same results no matter how different the embedded vector #63

Open
huanasilla opened this issue Jan 14, 2021 · 6 comments
Open

Comments

@huanasilla
Copy link

I queried something like this:

curl -XGET "$HOST/sappearance/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "function_score": {
      "boost_mode": "replace",
      "boost": 1,
      "script_score": {
        "script": {
          "source": "binary_vector_score",
          "lang": "knn",
          "params": {
            "cosine": false,
            "field": "embedded",
            "encoded_vector":
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPd9jHwAAAAA3BiywAAAAAAAAAAAAAAAAAAAAAD2f0Q8AAAAAAAAAAD1IY4k8kpnOAAAAAAAAAAA9r5S5PNp8mgAAAAAAAAAAOpXNNwAAAAA78meIAAAAAAAAAAA7yL4/AAAAAAAAAAA9c3QgAAAAAAAAAAAAAAAAAAAAADwIS5M+JBA+PM1oEwAAAAAAAAAAPb7UFgAAAAAAAAAAAAAAAAAAAAAAAAAAPWuvPwAAAAAAAAAAPgdXbwAAAAAAAAAAAAAAAAAAAAA8vUoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPe0Z4QAAAAAAAAAAAAAAAAAAAAA9WR3bAAAAAD4IS4kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPbxhFzu8AFU9wkM7Pu8+/DWUJz0AAAAAAAAAAAAAAAAAAAAAPgz/cTvKBXU6sPdoO7pa0wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD1I7TE9QvIvAAAAAAAAAAAAAAAAAAAAADG9brM9v30LAAAAADwYBwAAAAAAAAAAADwkH0w9wzCCAAAAAAAAAAAAAAAA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"_type" : "_doc",
       "_id" : "GYE1_3YB81_RQuAAxOtM",
       "_score" : 1.54172978,
       "_source" : {
         "_pid" : 1,
         "timestamp" : "2021-01-14T10:52:03.269931",
         "embedded" : "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPH44hAAAAAA2tlDbAAAAAAAAAAAAAAAAAAAAADu2GI4AAAAAAAAAADzdAeUAAAAAAAAAAAAAAAA9b6oLPLjqkgAAAAAAAAAAO4ARngAAAAA7RMb5AAAAAAAAAAA+QUhjAAAAAAAAAAA92vL+AAAAAAAAAAAAAAAAAAAAAD0W+xM8nRQrAAAAAAAAAAAAAAAAPHEDYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzXB4EAAAAAPh0ZFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4vqOU9HL46AAAAAAAAAAA9Jby8AAAAADwdLPYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8723XAAAAAD4nAwcAAAAAAAAAAAAAAAAAAAAAPQvDVwAAAAAAAAAAAAAAAAAAAAAAAAAAPh9yFgAAAAA9AVv4PkSx5DWWR1sAAAAAAAAAAAAAAAAAAAAAPbCmkQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADptaK4AAAAAPPxQewAAAAA8FK5VAAAAAAAAAAAAAAAAAAAAADHDmmg+jGplAAAAAD0Bk8IAAAAAAAAAADpaBB49cp4xAAAAAAAAAAAAAAAAAAAAAD1aN9MAAAAAAAAAAAAAAAAAAAAAPIqs2gAAAAAAAAAAAAAAAAAAAAAAAAAAO5j31TyGwcI9BY5pAAAAAAAAAAAAAAAAPLWsTD3CWH4AAAAAAAAAADyVkqYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD0SScgAAAAAAAAAAAAAAAA7n+1XAAAAAD2Ds0E+B+N/AAAAAAAAAAA9UZolAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAA+DdPtAAAAAAAAAAAAAAAAPg6qtgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD0b8YI8r1EXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA840plAAAAAAAAAAAAAAAAPSibcgAAAAAAAAAAAAAAADwzzUQAAAAAPZ8IuD0OtxcAAAAAPd9RmQAAAAAAAAAAAAAAAAAAAAAAAAAAPLG+wAAAAAA+DcGNPKaStwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyKOF48xiVyPglCuQAAAAAAAAAAAAAAAAAAAAA+PaxuAAAAAAAAAAAxuH6eAAAAAAAAAAAAAAAAAAAAADzZKPw9yr4VOyWMOgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO88zPAAAAAAAAAAAAAAAAAAAAAAAAAAAOzSNSAAAAAAAAAAAAAAAAAAAAAAAAAAAPAiZfwAAAAAAAAAAAAAAAAAAAAA+EOQyAAAAAAAAAAA7HLBxAAAAAAAAAAAAAAAAAAAAAD3LuNcAAAAAAAAAAD07eUkAAAAAPAmuJgAAAAAAAAAAPHIMCgAAAAA7NrnXPLvIHQAAAAA8Jly5AAAAAAAAAAA9GtBEAAAAAAAAAAA=",
         "camera_id" : 100
       }
     },
     {
       "_index" : "sappearance",
       "_type" : "_doc",
       "_id" : "NoE1_3YB81_RQuAAxes0",
       "_score" : 1.54172978,
       "_source" : {
         "_pid" : 1,
         "timestamp" : "2021-01-14T10:52:05.291303",
         "embedded" : "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA23yhyAAAAAAAAAAAAAAAAAAAAADzBIC4AAAAAAAAAADyI2DoAAAAAAAAAAAAAAA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AAAAAAAD6OjWA89K8kPmDYVz2DNZgAAAAAPOrL6AAAAAAAAAAAPAGmtQAAAAAAAAAAPOAJMAAAAAA97jIrOkbWCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADw1rCI9GCJFAAAAAAAAAAAxuHOHAAAAAAAAAAAAAAAAAAAAAD2APzg+EWdMOkfA3gAAAAAAAAAAAAAAAAAAAAAAAAAAPgjZDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2qvQ8AAAAAPExDSQAAAAAAAAAAAAAAAAAAAAA9dX39AAAAAAAAAAA9TPA7AAAAAAAAAAAAAAAAAAAAAD1g4ygAAAAAAAAAADwqjHAAAAAAPCe20AAAAAAAAAAAPI6GmQAAAAAAAAAAPR9I+QAAAAAAAAAAAAAAAAAAAAA7neglAAAAAAAAAAA=",
         "camera_id" : 100
       }
     },
     {
       "_index" : "sappearance",
       "_type" : "_doc",
       "_id" : "G4E1_3YB81_RQuAAxOtb",
       "_score" : 1.54172978,
       "_source" : {
         "_pid" : 1,
         "timestamp" : "2021-01-14T10:52:03.269931",
         "embedded" : "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2l/zeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9hlGVPIS9vwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+O1EDAAAAAAAAAAA9i7acAAAAAAAAAAAAAAAAAAAAAD3VwS09S38KAAAAAAAAAAAAAAAAPHjBHQAAAAAAAAAAAAAAAAAAAAAAAAAAOxjfrAAAAAAAAAAAPjGkgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD5H5CQ89DxFAAAAAAAAAAA9KXtfAAAAAD1u6akAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPKA2GAAAAAAAAAAAAAAAAAAAAAA+HWniAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD3mAGkAAAAAAAAAAD2i2QIAAAAAAAAAAAAAAAAAAAAAO+V7yQAAAAA8R4saPLMS8QAAAAAAAAAAAAAAAAAAAAA8i4mBAAAAAAAAAAA=",
         "camera_id" : 100
       }
     }
   ]
Could you help me out? If I use the built-in dot product function there is no problem. 
@KKbeom
Copy link

KKbeom commented Feb 15, 2021

@lior-k
I'm having the same problem.

@joy-ko
Copy link

joy-ko commented Feb 25, 2021

@lior-k
Thanks for your work.
However, I am going through the same problem.
the plugin returns the same score no matter what the sentence is.
It seems to follow that of the first document's score.

Is it a bug? or Is there any kinds of possibility that I made mistake?

@lior-k
Copy link
Owner

lior-k commented Feb 26, 2021

What is the ES version you guys use?

@KKbeom
Copy link

KKbeom commented Feb 26, 2021

@lior-k
I used Elasticsearch version 7.9.3 and 7.9.0, then using your 'es-7.9.0' branch code. But, get same problem with both.

@PanchenkoYehor
Copy link

Thank you @lior-k for your work. Do you have any updates from here? I got the same error

Mapping is

{
        "settings": {
            "number_of_shards": 1,
            "number_of_replicas": 0
        },
        "mappings": {
            "properties": {
                "vectorField": {
                    "type": "binary",
                    "doc_values": True
                  },
            }
        }
    }

Query to ask is

{
  "query": {
    "function_score": {
      "boost_mode": "replace",
      "script_score": {
        "script": {
	      "source": "binary_vector_score",
          "lang": "knn",
          "params": {
            "cosine": True,
            "field": "vectorField",
            "vector": list(np.random.rand(512))
          }
        }
      }
    }
  },
  "size": 10
}

The output result is

{'took': 2,
 'timed_out': False,
 '_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0},
 'hits': {'total': {'value': 10, 'relation': 'eq'},
  'max_score': 0.87545174,
  'hits': [{'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind0',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind1',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind2',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind3',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind4',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind5',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind6',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind7',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind8',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}},
   {'_index': 'here9201float',
    '_type': '_doc',
    '_id': 'ind9',
    '_score': 0.87545174,
    '_source': {'vectorField': 'encoded-values-here='}}]}}

I use the 7.9.0 ES version and cloned the corresponded branch. Hope you help me

@Snow-Dancing
Copy link

@lior-k
Thanks for your work!
I have solved the above problem that appeared in branch 7.9.0 by debugging es locally.

Bug code in VectorScoreScript.java, line29~30:

final byte[] bytes = binaryEmbeddingReader.binaryValue().bytes;
final ByteArrayDataInput input = new ByteArrayDataInput(bytes);

The right code should be:

final BytesRef bytesRef = binaryEmbeddingReader.binaryValue();
final ByteArrayDataInput input = new ByteArrayDataInput(bytesRef.bytes, bytesRef.offset, bytesRef.length);

Please fix this bug.

Reference:
Official usage of BytesRef in ElasticSearch, see AbstractBinaryDVLeafFieldData.java, line62~66:

final BytesRef bytes = values.binaryValue();
assert bytes.length > 0;
in.reset(bytes.bytes, bytes.offset, bytes.length);
count = in.readVInt();
scratch.bytes = bytes.bytes;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants