A
A
Anton Ivanov2014-10-03 12:30:40
elasticsearch
Anton Ivanov, 2014-10-03 12:30:40

How to search by long field in elasticsearch?

Hello!
There are two types under one index in elasticsearch.
For example, order/create and order/update
in mapping of both types have an order_id field with type long
for order number one, there are entries in both create and update
. If you make a request like localhost:9200/order/_search?q=order_id:1, then no results at all.
If we make a request with the exact type, for example localhost:9200/order/create/_search?q=order_id:1, then we will get the correct result (one). And you need to get all the actions with the order with one request.
At the same time, if we change the type from long to string in the mappings, then everything starts working as expected. I've been reading the elasticsearch documentation all day today, but I didn't find it,Where did I go wrong , what did I do wrong.
Also, if you do not specify the parameter name, but do a search by _all, then all the expected results are returned. that is, like this: localhost:9200/order/_search?q=1
PS When the type is long, no search option works for searching in /order. Not a simple term, not a range query, not a uri search

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question