Skip to content
This repository was archived by the owner on Jan 31, 2018. It is now read-only.

Commit 20199e7

Browse files
committed
Change match/match_phrase to text/text_phrase
Input isn't working on -dev environment. My hunch is that it's because I'm using ES things that the -dev environment ES doesn't support.
1 parent bf97583 commit 20199e7

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

fjord/analytics/tests/test_tools.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def test_unescape(self):
5151
def test_query_parsed(self):
5252
self.assertEqual(
5353
generate_query_parsed('foo', u'abc'),
54-
{'match': {'foo': u'abc'}})
54+
{'text': {'foo': u'abc'}})
5555

5656
self.assertEqual(
5757
generate_query_parsed('foo', u'abc def'),
58-
{'match': {'foo': u'abc def'}},
58+
{'text': {'foo': u'abc def'}},
5959
)
6060

6161
self.assertEqual(
@@ -64,9 +64,9 @@ def test_query_parsed(self):
6464
'bool': {
6565
'minimum_should_match': 1,
6666
'should': [
67-
{'match': {'foo': u'abc'}},
68-
{'match_phrase': {'foo': u'def'}},
69-
{'match': {'foo': u'ghi'}},
67+
{'text': {'foo': u'abc'}},
68+
{'text_phrase': {'foo': u'def'}},
69+
{'text': {'foo': u'ghi'}},
7070
]
7171
}
7272
}
@@ -77,8 +77,8 @@ def test_query_parsed(self):
7777
{
7878
'bool': {
7979
'must': [
80-
{'match': {'foo': u'abc'}},
81-
{'match_phrase': {'foo': u'def'}},
80+
{'text': {'foo': u'abc'}},
81+
{'text_phrase': {'foo': u'def'}},
8282
]
8383
}
8484
}
@@ -90,11 +90,11 @@ def test_query_parsed(self):
9090
'bool': {
9191
'minimum_should_match': 1,
9292
'should': [
93-
{'match': {'foo': u'abc'}},
93+
{'text': {'foo': u'abc'}},
9494
{'bool': {
9595
'must': [
96-
{'match_phrase': {'foo': u'def'}},
97-
{'match': {'foo': u'ghi'}},
96+
{'text_phrase': {'foo': u'def'}},
97+
{'text': {'foo': u'ghi'}},
9898
]
9999
}}
100100
]
@@ -107,12 +107,12 @@ def test_query_parsed(self):
107107
{
108108
'bool': {
109109
'must': [
110-
{'match': {'foo': u'abc'}},
110+
{'text': {'foo': u'abc'}},
111111
{'bool': {
112112
'minimum_should_match': 1,
113113
'should': [
114-
{'match_phrase': {'foo': u'def'}},
115-
{'match': {'foo': u'ghi'}},
114+
{'text_phrase': {'foo': u'def'}},
115+
{'text': {'foo': u'ghi'}},
116116
]
117117
}}
118118
]
@@ -122,7 +122,7 @@ def test_query_parsed(self):
122122

123123
self.assertEqual(
124124
generate_query_parsed('foo', u'14.1\\" screen'),
125-
{'match': {'foo': u'14.1" screen'}}
125+
{'text': {'foo': u'14.1" screen'}}
126126
)
127127

128128
def test_query_parsed_edge_cases(self):
@@ -131,7 +131,7 @@ def test_query_parsed_edge_cases(self):
131131
{
132132
'bool': {
133133
'must': [
134-
{'match_phrase': {'foo': u'def'}}
134+
{'text_phrase': {'foo': u'def'}}
135135
]
136136
}
137137
}
@@ -142,18 +142,18 @@ def test_query_parsed_edge_cases(self):
142142
{
143143
'bool': {
144144
'must': [
145-
{'match_phrase': {'foo': u'def'}}
145+
{'text_phrase': {'foo': u'def'}}
146146
]
147147
}
148148
}
149149
)
150150

151151
self.assertEqual(
152152
generate_query_parsed('foo', u'foo\\bar'),
153-
{'match': {'foo': u'foobar'}}
153+
{'text': {'foo': u'foobar'}}
154154
)
155155

156156
self.assertEqual(
157157
generate_query_parsed('foo', u'foo\\\\bar'),
158-
{'match': {'foo': u'foo\\bar'}}
158+
{'text': {'foo': u'foo\\bar'}}
159159
)

fjord/analytics/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ def unescape(text):
8282

8383

8484
def build_match(field, token):
85-
return {'match': {field: unescape(token)}}
85+
return {'text': {field: unescape(token)}}
8686

8787

8888
def build_match_phrase(field, token):
89-
return {'match_phrase': {field: unescape(token)}}
89+
return {'text_phrase': {field: unescape(token)}}
9090

9191

9292
def build_or(clauses):

0 commit comments

Comments
 (0)